Definition at line 29 of file Config.php.
◆ __construct()
__construct |
( |
array |
$array, |
|
|
|
$allowModifications = false |
|
) |
| |
Zend_Config provides a property based interface to an array. The data are read-only unless $allowModifications is set to true on construction.
Zend_Config also implements Countable and Iterator to facilitate easy access to the data.
- Parameters
-
array | $array | |
boolean | $allowModifications | |
- Returns
- void
Definition at line 105 of file Config.php.
107 $this->_allowModifications = (boolean) $allowModifications;
108 $this->_loadedSection =
null;
110 $this->_data = array();
111 foreach ($array as $key =>
$value) {
115 $this->_data[$key] =
$value;
118 $this->_count =
count($this->_data);
◆ __clone()
Deep clone of this instance to ensure that nested Zend_Configs are also cloned.
- Returns
- void
Definition at line 179 of file Config.php.
182 foreach ($this->_data as $key =>
$value) {
184 $array[$key] = clone
$value;
189 $this->_data = $array;
◆ __get()
Magic function so that $obj->value will work.
- Parameters
-
- Returns
- mixed
Definition at line 143 of file Config.php.
145 return $this->
get(
$name);
if(!isset($_GET['name'])) $name
◆ __isset()
Support isset() overloading on PHP 5.1
- Parameters
-
- Returns
- boolean
Definition at line 217 of file Config.php.
219 return isset($this->_data[
$name]);
if(!isset($_GET['name'])) $name
◆ __set()
Only allow setting of a property if $allowModifications was set to true on construction. Otherwise, throw an exception.
- Parameters
-
- Exceptions
-
- Returns
- void
- See also
- Zend_Config_Exception
Definition at line 157 of file Config.php.
159 if ($this->_allowModifications) {
165 $this->_count =
count($this->_data);
168 #require_once 'Zend/Config/Exception.php';
if(!isset($_GET['name'])) $name
◆ __unset()
Support unset() overloading on PHP 5.1
- Parameters
-
- Exceptions
-
- Returns
- void
- See also
- Zend_Config_Exception
Definition at line 229 of file Config.php.
231 if ($this->_allowModifications) {
232 unset($this->_data[
$name]);
233 $this->_count =
count($this->_data);
234 $this->_skipNextIteration =
true;
237 #require_once 'Zend/Config/Exception.php';
if(!isset($_GET['name'])) $name
◆ _arrayMergeRecursive()
_arrayMergeRecursive |
( |
|
$firstArray, |
|
|
|
$secondArray |
|
) |
| |
|
protected |
Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.
- Parameters
-
mixed | $firstArray | First array |
mixed | $secondArray | Second array to merge into first array |
- Returns
- array
Definition at line 464 of file Config.php.
466 if (is_array($firstArray) && is_array($secondArray)) {
467 foreach ($secondArray as $key =>
$value) {
468 if (isset($firstArray[$key])) {
474 $firstArray[$key] =
$value;
479 $firstArray = $secondArray;
_arrayMergeRecursive($firstArray, $secondArray)
◆ _assertValidExtend()
_assertValidExtend |
( |
|
$extendingSection, |
|
|
|
$extendedSection |
|
) |
| |
|
protected |
Throws an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.
- Parameters
-
string | $extendingSection | |
string | $extendedSection | |
- Exceptions
-
- Returns
- void
- See also
- Zend_Config_Exception
Definition at line 423 of file Config.php.
426 $extendedSectionCurrent = $extendedSection;
427 while (array_key_exists($extendedSectionCurrent, $this->_extends)) {
428 if ($this->_extends[$extendedSectionCurrent] == $extendingSection) {
430 #require_once 'Zend/Config/Exception.php'; 433 $extendedSectionCurrent = $this->_extends[$extendedSectionCurrent];
436 $this->_extends[$extendingSection] = $extendedSection;
◆ _loadFileErrorHandler()
_loadFileErrorHandler |
( |
|
$errno, |
|
|
|
$errstr, |
|
|
|
$errfile, |
|
|
|
$errline |
|
) |
| |
Handle any errors from simplexml_load_file or parse_ini_file
- Parameters
-
integer | $errno | |
string | $errstr | |
string | $errfile | |
integer | $errline | |
Definition at line 447 of file Config.php.
449 if ($this->_loadFileErrorStr ===
null) {
450 $this->_loadFileErrorStr = $errstr;
452 $this->_loadFileErrorStr .= (PHP_EOL . $errstr);
◆ areAllSectionsLoaded()
Returns true if all sections were loaded
- Returns
- boolean
Definition at line 327 of file Config.php.
329 return $this->_loadedSection ===
null;
◆ count()
Defined by Countable interface
- Returns
- int
Definition at line 248 of file Config.php.
◆ current()
Defined by Iterator interface
- Returns
- mixed
Definition at line 258 of file Config.php.
260 $this->_skipNextIteration =
false;
◆ get()
get |
( |
|
$name, |
|
|
|
$default = null |
|
) |
| |
Retrieve a value and return $default if there is no element set.
- Parameters
-
string | $name | |
mixed | $default | |
- Returns
- mixed
Definition at line 128 of file Config.php.
131 if (array_key_exists(
$name, $this->_data)) {
if(!isset($_GET['name'])) $name
◆ getExtends()
Get the current extends
- Returns
- array
Definition at line 393 of file Config.php.
◆ getSectionName()
Returns the section name(s) loaded.
- Returns
- mixed
Definition at line 314 of file Config.php.
316 if(is_array($this->_loadedSection) &&
count($this->_loadedSection) == 1) {
317 $this->_loadedSection = $this->_loadedSection[0];
◆ key()
Defined by Iterator interface
- Returns
- mixed
Definition at line 269 of file Config.php.
271 return key($this->_data);
◆ merge()
Merge another Zend_Config with this one. The items in $merge will override the same named items in the current config.
- Parameters
-
- Returns
- Zend_Config
Definition at line 341 of file Config.php.
343 foreach($merge as $key =>
$item) {
344 if(array_key_exists($key, $this->_data)) {
◆ next()
Defined by Iterator interface
Definition at line 278 of file Config.php.
280 if ($this->_skipNextIteration) {
281 $this->_skipNextIteration =
false;
◆ readOnly()
◆ rewind()
Defined by Iterator interface
Definition at line 292 of file Config.php.
294 $this->_skipNextIteration =
false;
◆ setExtend()
setExtend |
( |
|
$extendingSection, |
|
|
|
$extendedSection = null |
|
) |
| |
Set an extend for Zend_Config_Writer
- Parameters
-
string | $extendingSection | |
string | $extendedSection | |
- Returns
- void
Definition at line 405 of file Config.php.
407 if ($extendedSection ===
null && isset($this->_extends[$extendingSection])) {
408 unset($this->_extends[$extendingSection]);
409 }
else if ($extendedSection !==
null) {
410 $this->_extends[$extendingSection] = $extendedSection;
◆ setReadOnly()
Prevent any more modifications being made to this instance. Useful after merge() has been used to merge multiple Zend_Config objects into one object which should then not be modified again.
Definition at line 368 of file Config.php.
370 $this->_allowModifications =
false;
371 foreach ($this->_data as $key =>
$value) {
◆ toArray()
Return an associative array of the stored data.
- Returns
- array
Definition at line 197 of file Config.php.
203 $array[$key] =
$value->toArray();
◆ valid()
Defined by Iterator interface
- Returns
- boolean
Definition at line 304 of file Config.php.
◆ $_allowModifications
◆ $_count
◆ $_data
◆ $_extends
◆ $_index
◆ $_loadedSection
◆ $_loadFileErrorStr
$_loadFileErrorStr = null |
|
protected |
◆ $_skipNextIteration
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Config.php