Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Config / Processor / Constant.php
blob265c937db2c4180fca9d60b0ea2f374d17e98efe
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Config\Processor;
12 class Constant extends Token implements ProcessorInterface
14 /**
15 * Replace only user-defined tokens
17 * @var bool
19 protected $userOnly = true;
21 /**
22 * Constant Processor walks through a Config structure and replaces all
23 * PHP constants with their respective values
25 * @param bool $userOnly True to process only user-defined constants, false to process all PHP constants
26 * @param string $prefix Optional prefix
27 * @param string $suffix Optional suffix
28 * @return \Zend\Config\Processor\Constant
30 public function __construct($userOnly = true, $prefix = '', $suffix = '')
32 $this->setUserOnly($userOnly);
33 $this->setPrefix($prefix);
34 $this->setSuffix($suffix);
36 $this->loadConstants();
39 /**
40 * @return bool
42 public function getUserOnly()
44 return $this->userOnly;
47 /**
48 * Should we use only user-defined constants?
50 * @param bool $userOnly
51 * @return Constant
53 public function setUserOnly($userOnly)
55 $this->userOnly = (bool) $userOnly;
56 return $this;
59 /**
60 * Load all currently defined constants into parser.
62 * @return void
64 public function loadConstants()
66 if ($this->userOnly) {
67 $constants = get_defined_constants(true);
68 $constants = isset($constants['user']) ? $constants['user'] : array();
69 $this->setTokens($constants);
70 } else {
71 $this->setTokens(get_defined_constants());
75 /**
76 * Get current token registry.
77 * @return array
79 public function getTokens()
81 return $this->tokens;