Merge pull request #15944 from magnolia61/Sort_CMS_tables_alphabetically
[civicrm-core.git] / CRM / Utils / Constant.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035 11
50bfb460
SB
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
50bfb460
SB
16 */
17
5bc392e6
EM
18/**
19 * Class CRM_Utils_Constant
20 */
6a488035
TO
21class CRM_Utils_Constant {
22
23 /**
02549793 24 * Determine the value of a constant, if any.
5bc392e6 25 *
02549793 26 * If the specified constant is undefined, return a default value.
6a488035
TO
27 *
28 * @param string $name
29 * @param mixed $default
02549793 30 * (optional)
6a488035
TO
31 * @return mixed
32 */
33 public static function value($name, $default = NULL) {
34 if (defined($name)) {
35 return constant($name);
0db6c3e1
TO
36 }
37 else {
6a488035
TO
38 return $default;
39 }
40 }
96025800 41
232624b1 42}