PHP Class DataSift\Storyplayer\ConfigLib\WrappedConfig

Show file Open project: datasift/storyplayer Class Usage Examples

Public Methods

Method Description
__construct ( $isArray = false ) constructor
getArray ( string $path ) : array retrieve data from a dot.notation.path
getConfig ( ) : array | object get the config that we wrap
getData ( string $path ) : mixed retrieve data using a dot.notation.path
getExpandedConfig ( array | object | null $baseConfig = null ) : array | object expand any variables in $this
getFilename ( ) : string | null returns the filename we loaded this config from
getName ( ) : string | null returns the name assigned to this config
getObject ( string $path ) : object retrieve data from a dot.notation.path
hasData ( string $path ) : boolean check for existence of data using a dot.notation.path
loadConfigFromFile ( string $pathToFile ) : void load a config file from disk, and store the config in $this
mergeData ( string $path, mixed $dataToMerge ) : void merge data into this config
setConfig ( array | object $config ) store the config that we wrap
setData ( string $path, mixed $data ) : void assigns data to a specific path
setFilename ( string $filename ) sets the filename that we loaded this config from
setName ( string $name ) assigns a name to this config
unsetData ( string $path ) : void remove data using a dot.notation.path

Method Details

__construct() public method

constructor
public __construct ( $isArray = false )

getArray() public method

throws an exception if the path does not point to an array
public getArray ( string $path ) : array
$path string the dot.notation.path to the data to return
return array

getConfig() public method

get the config that we wrap
public getConfig ( ) : array | object
return array | object

getData() public method

NOTE that you should treat any data returned from here as READ-ONLY
public getData ( string $path ) : mixed
$path string the dot.notation.path to use to navigate
return mixed

getExpandedConfig() public method

expand any variables in $this
public getExpandedConfig ( array | object | null $baseConfig = null ) : array | object
$baseConfig array | object | null the config to use for expanding variables (optional)
return array | object a copy of the config stored in $this, with any Twig variables expanded

getFilename() public method

returns the filename we loaded this config from
public getFilename ( ) : string | null
return string | null

getName() public method

returns the name assigned to this config
public getName ( ) : string | null
return string | null

getObject() public method

throws an exception if the path does not point to an object
public getObject ( string $path ) : object
$path string the dot.notation.path to the data to return
return object

hasData() public method

check for existence of data using a dot.notation.path
public hasData ( string $path ) : boolean
$path string the dot.notation.path to use to navigate
return boolean

loadConfigFromFile() public method

load a config file from disk, and store the config in $this
public loadConfigFromFile ( string $pathToFile ) : void
$pathToFile string the filename to load from
return void

mergeData() public method

merge data into this config
public mergeData ( string $path, mixed $dataToMerge ) : void
$path string path.to.merge.to
$dataToMerge mixed the data to merge at $path
return void

setConfig() public method

store the config that we wrap
public setConfig ( array | object $config )
$config array | object the config to store

setData() public method

assigns data to a specific path
public setData ( string $path, mixed $data ) : void
$path string the path to assign to
$data mixed the data to assign
return void

setFilename() public method

sets the filename that we loaded this config from
public setFilename ( string $filename )
$filename string the filename to store

setName() public method

assigns a name to this config
public setName ( string $name )
$name string the name to assign

unsetData() public method

remove data using a dot.notation.path
public unsetData ( string $path ) : void
$path string the dot.notation.path to use to navigate
return void