PHP Class Webiny\Component\Config\ConfigObject

Inheritance: implements ArrayAccess, implements IteratorAggregate, use trait Webiny\Component\StdLib\StdObjectTrait, use trait Webiny\Component\StdLib\ValidatorTrait
显示文件 Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$data Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject Config data

Public Methods

Method Description
__construct ( array | ArrayObject | AbstractDriver $resource = [], boolean $cache = true ) ConfigObject is an object representing config data in an OO way
__get ( string $name ) : mixed Access internal data as if it was a real object
__isset ( string $name ) : boolean Override __isset
__set ( string $name, mixed $value ) : void Set internal data as if it was a real object
__toString ( )
__unset ( string $name ) : void Override __unset
__wakeup ( )
determineResourceType ( $resource ) : string Determine type of given resource
get ( string $name, mixed $default = null, boolean $toArray = false ) : mixed | ConfigObject Get value or return $default if there is no element set.
getAs ( AbstractDriver $driver )
getAsIni ( $useSections = true, $nestDelimiter = '.' )
getAsJson ( )
getAsPhp ( )
getAsYaml ( integer $indent = 4 ) : string Get config as Yaml string
getIterator ( )
mergeWith ( array | ArrayObject | ConfigObject $config ) Merge current config with given config
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
serialize ( )
set ( string $name, mixed $value ) Set config object value You can also access deeper values by using dotted key notation: level1.level2.level3.key
toArray ( boolean $asArrayObject = false ) : array | ArrayObject Get Config data in form of an array or ArrayObject
unserialize ( $string )

Private Methods

Method Description
buildInternalData ( array | ArrayObject $config ) Build internal object data using given $config

Method Details

__construct() public method

ConfigObject is an object representing config data in an OO way
public __construct ( array | ArrayObject | AbstractDriver $resource = [], boolean $cache = true )
$resource array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | Webiny\Component\Config\Drivers\AbstractDriver Config resource
$cache boolean Store ConfigObject to cache or not

__get() public method

Access internal data as if it was a real object
public __get ( string $name ) : mixed
$name string
return mixed

__isset() public method

Override __isset
public __isset ( string $name ) : boolean
$name string
return boolean

__set() public method

Set internal data as if it was a real object
public __set ( string $name, mixed $value ) : void
$name string
$value mixed
return void

__toString() public method

public __toString ( )

__unset() public method

Override __unset
public __unset ( string $name ) : void
$name string
return void

__wakeup() public method

public __wakeup ( )

determineResourceType() public static method

Determine type of given resource
public static determineResourceType ( $resource ) : string
$resource
return string

get() public method

You can also access deeper values by using dotted key notation: level1.level2.level3.key
public get ( string $name, mixed $default = null, boolean $toArray = false ) : mixed | ConfigObject
$name string
$default mixed
$toArray boolean
return mixed | ConfigObject Config value or default value

getAs() public method

public getAs ( AbstractDriver $driver )
$driver Webiny\Component\Config\Drivers\AbstractDriver

getAsIni() public method

public getAsIni ( $useSections = true, $nestDelimiter = '.' )

getAsJson() public method

public getAsJson ( )

getAsPhp() public method

public getAsPhp ( )

getAsYaml() public method

Get config as Yaml string
public getAsYaml ( integer $indent = 4 ) : string
$indent integer
return string

getIterator() public method

public getIterator ( )

mergeWith() public method

Merge current config with given config
public mergeWith ( array | ArrayObject | ConfigObject $config )
$config array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | ConfigObject ConfigObject or array of ConfigObject to merge with

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

serialize() public method

public serialize ( )

set() public method

Set config object value You can also access deeper values by using dotted key notation: level1.level2.level3.key
public set ( string $name, mixed $value )
$name string
$value mixed

toArray() public method

Get Config data in form of an array or ArrayObject
public toArray ( boolean $asArrayObject = false ) : array | ArrayObject
$asArrayObject boolean (Optional) Defaults to false
return array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject Config data array or ArrayObject

unserialize() public method

public unserialize ( $string )

Property Details

$data protected_oe property

Config data
protected ArrayObject,Webiny\Component\StdLib\StdObject\ArrayObject $data
return Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject