Config/Json.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Config
- Version
- $Id$
\Zend_Config_Json
Package: Zend_Config
Throws
JSON Adapter for Zend_Config
- Parent(s)
- \Zend_Config
- Category
- Zend
- Copyright
- Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
bool $_ignoreConstants = false
Whether or not to ignore constants in the JSON string
Note: if you do not have constant names in quotations in your JSON
string, they may lead to syntax errors when parsing.
Default valuefalse
Details- Type
- bool
Methods
__construct(string $json, mixed $section = null, boolean $options = false) : void
Loads the section $section from the config file encoded as JSON
Sections are defined as properties of the main object
In order to extend another section, a section defines the "_extends"
property having a value of the section name from which the extending
section inherits values.
Note that the keys in $section will override any keys of the same
name in the sections that have been included via "_extends".
ParametersName | Type | Description |
---|---|---|
$json | string | JSON file or string to process |
$section | mixed | Section to process |
$options | boolean | Whether modifiacations are allowed at runtime |
Exception | Description |
---|---|
\Zend_Config_Exception | When JSON text is not set or cannot be loaded |
\Zend_Config_Exception | When section $sectionName cannot be found in $json |
_getConstants() : array
Get (reverse) sorted list of defined constant names
Returns
Type | Description |
---|---|
array |
_processExtends(array $data, string $section, array $config = array()) : array
Helper function to process each element in the section and handle the "_extends" inheritance attribute.
Parameters
Returns
Throws
Name | Type | Description |
---|---|---|
$data | array | Data array to process |
$section | string | Section to process |
$config | array | Configuration which was parsed yet |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Config_Exception | When $section cannot be found |