PHP Class Art4\JsonApiClient\Utils\DataContainer

Inheritance: implements Art4\JsonApiClient\Utils\DataContainerInterface
Show file Open project: art4/json-api-client

Protected Properties

Property Type Description
$allowed_keys array
$data array

Public Methods

Method Description
__construct ( array $allowed_keys = [] )
asArray ( boolean $fullArray = false ) : array Convert this object in an array
get ( mixed $key ) : mixed Get a value by a key
getKeys ( ) : array Returns the keys of all setted values
has ( mixed $key ) : boolean Check if a value exists
set ( string $key, mixed $value ) : self Set a value

Protected Methods

Method Description
getValue ( string $key ) : mixed Get a value by the key
objectTransform ( $val ) : mixed Transforms objects to arrays
parseKey ( string | AccessKey $key ) : AccessKey Parse a dot.notated.key to an object

Method Details

__construct() public method

public __construct ( array $allowed_keys = [] )
$allowed_keys array Keys of allowed values

asArray() public method

Convert this object in an array
public asArray ( boolean $fullArray = false ) : array
$fullArray boolean If true, objects are transformed into arrays recursively
return array

get() public method

Get a value by a key
public get ( mixed $key ) : mixed
$key mixed The key
return mixed

getKeys() public method

Returns the keys of all setted values
public getKeys ( ) : array
return array Keys of all setted values

getValue() protected method

Get a value by the key
protected getValue ( string $key ) : mixed
$key string The key of the value
return mixed The value

has() public method

Check if a value exists
public has ( mixed $key ) : boolean
$key mixed The key
return boolean

objectTransform() protected method

Transforms objects to arrays
protected objectTransform ( $val ) : mixed
$val
return mixed

parseKey() protected method

Parse a dot.notated.key to an object
protected parseKey ( string | AccessKey $key ) : AccessKey
$key string | AccessKey The key
return AccessKey The parsed key

set() public method

Set a value
public set ( string $key, mixed $value ) : self
$key string The Key
$value mixed The Value
return self

Property Details

$allowed_keys protected property

protected array $allowed_keys
return array

$data protected property

protected array $data
return array