Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Config_Json Class Reference

Public Member Functions

 __construct ($json, $section=null, $options=false)
 Loads the section $section from the config file encoded as JSON.
 
- Public Member Functions inherited from Zend_Config
 __construct (array $array, $allowModifications=false)
 Zend_Config provides a property based interface to an array.
 
 get ($name, $default=null)
 Retrieve a value and return $default if there is no element set.
 
 __get ($name)
 Magic function so that $obj->value will work.
 
 __set ($name, $value)
 Only allow setting of a property if $allowModifications was set to true on construction.
 
 __clone ()
 Deep clone of this instance to ensure that nested Zend_Configs are also cloned.
 
 toArray ()
 Return an associative array of the stored data.
 
 __isset ($name)
 Support isset() overloading on PHP 5.1.
 
 __unset ($name)
 Support unset() overloading on PHP 5.1.
 
 count ()
 Defined by Countable interface.
 
 current ()
 Defined by Iterator interface.
 
 key ()
 Defined by Iterator interface.
 
 next ()
 Defined by Iterator interface.
 
 rewind ()
 Defined by Iterator interface.
 
 valid ()
 Defined by Iterator interface.
 
 getSectionName ()
 Returns the section name(s) loaded.
 
 areAllSectionsLoaded ()
 Returns true if all sections were loaded.
 
 merge (Zend_Config $merge)
 Merge another Zend_Config with this one.
 
 setReadOnly ()
 Prevent any more modifications being made to this instance.
 
 readOnly ()
 Returns if this Zend_Config object is read only or not.
 
 getExtends ()
 Get the current extends.
 
 setExtend ($extendingSection, $extendedSection=null)
 Set an extend for Zend_Config_Writer.
 
 _loadFileErrorHandler ($errno, $errstr, $errfile, $errline)
 Handle any errors from simplexml_load_file or parse_ini_file.
 

Public Attributes

const EXTENDS_NAME = "_extends"
 Name of object key indicating section current section extends.
 

Protected Member Functions

 _processExtends (array $data, $section, array $config=array())
 Helper function to process each element in the section and handle the "_extends" inheritance attribute.
 
 _replaceConstants ($value)
 Replace any constants referenced in a string with their values.
 
 _getConstants ()
 Get (reverse) sorted list of defined constant names.
 
- Protected Member Functions inherited from Zend_Config
 _assertValidExtend ($extendingSection, $extendedSection)
 Throws an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.
 
 _arrayMergeRecursive ($firstArray, $secondArray)
 Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.
 

Protected Attributes

 $_ignoreConstants = false
 
 $_skipExtends = false
 
- Protected Attributes inherited from Zend_Config
 $_allowModifications
 
 $_index
 
 $_count
 
 $_data
 
 $_skipNextIteration
 
 $_loadedSection
 
 $_extends = array()
 
 $_loadFileErrorStr = null
 

Constructor & Destructor Documentation

__construct (   $json,
  $section = null,
  $options = false 
)

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
string$jsonJSON file or string to process
mixed$sectionSection to process
boolean$optionsWhether modifiacations are allowed at runtime
Exceptions
Zend_Config_ExceptionWhen JSON text is not set or cannot be loaded
Zend_Config_ExceptionWhen section $sectionName cannot be found in $json

Member Function Documentation

_getConstants ( )
protected

Get (reverse) sorted list of defined constant names.

Returns
array
_processExtends ( array  $data,
  $section,
array  $config = array() 
)
protected

Helper function to process each element in the section and handle the "_extends" inheritance attribute.

Parameters
array$dataData array to process
string$sectionSection to process
array$configConfiguration which was parsed yet
Exceptions
Zend_Config_ExceptionWhen $section cannot be found
Returns
array
_replaceConstants (   $value)
protected

Replace any constants referenced in a string with their values.

Parameters
string$value
Returns
string

Member Data Documentation

$_ignoreConstants = false
protected
$_skipExtends = false
protected
const EXTENDS_NAME = "_extends"

Name of object key indicating section current section extends.