API Documentation

Zend/Config/Json.php

Show: inherited
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: Json.php 23294 2010-11-05 00:27:34Z ramon $  

\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

Constant  EXTENDS_NAME = "_extends"

Name of object key indicating section current section extends

Properties

Propertyprotectedbool  $_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
Propertyprotectedboolean  $_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
Name Type Description
$json string

JSON file or string to process

$section mixed

Section to process

$options boolean

Whether modifiacations are allowed at runtime

Throws
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
methodprotected_getConstants( ) : array

Get (reverse) sorted list of defined constant names

Returns
Type Description
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
Name Type Description
$data array

Data array to process

$section string

Section to process

$config array

Configuration which was parsed yet

Returns
Type Description
array
Throws
Exception Description
\Zend_Config_Exception When $section cannot be found
methodprotected_replaceConstants( string $value ) : string

Replace any constants referenced in a string with their values

Parameters
Name Type Description
$value string
Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.