Config/Json.php

Show: PublicProtectedPrivateinherited
Table of Contents
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
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

>VConstant  EXTENDS_NAME = "_extends"
Name of object key indicating section current section extends

Properties

>VPropertyprotectedbool $_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 valuefalseDetails
Type
bool
>VPropertyprotectedboolean $_skipExtends = false
Whether to skip extends or not
Default valuefalseDetails
Type
boolean

Methods

methodpublic__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".
Parameters
NameTypeDescription
$jsonstring

JSON file or string to process

$sectionmixed

Section to process

$optionsboolean

Whether modifiacations are allowed at runtime

Throws
ExceptionDescription
\Zend_Config_ExceptionWhen JSON text is not set or cannot be loaded
\Zend_Config_ExceptionWhen section $sectionName cannot be found in $json
methodprotected_getConstants() : array

Get (reverse) sorted list of defined constant names

Returns
TypeDescription
array
methodprotected_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
NameTypeDescription
$dataarray

Data array to process

$sectionstring

Section to process

$configarray

Configuration which was parsed yet

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_ExceptionWhen $section cannot be found
methodprotected_replaceConstants(string $value) : string

Replace any constants referenced in a string with their values

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .