Merge pull request #16263 from eileenmcnaughton/ids_3
[civicrm-core.git] / CRM / Utils / Constant.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * Class CRM_Utils_Constant
20 */
21 class CRM_Utils_Constant {
22
23 /**
24 * Determine the value of a constant, if any.
25 *
26 * If the specified constant is undefined, return a default value.
27 *
28 * @param string $name
29 * @param mixed $default
30 * (optional)
31 * @return mixed
32 */
33 public static function value($name, $default = NULL) {
34 if (defined($name)) {
35 return constant($name);
36 }
37 else {
38 return $default;
39 }
40 }
41
42 }