PHP Class M1\Vars\Resource\AbstractResource

Since: 0.1.0
Inheritance: implements ArrayAccess
Show file Open project: m1/Vars

Protected Properties

Property Type Description
$content array The resource content

Public Methods

Method Description
arrayKeyExists ( mixed $key ) : boolean Port of array_key_exists to \ArrayAccess
get ( mixed $key ) : array | boolean | null Object oriented get access for the array
getContent ( ) : array Returns the content of the resource
offsetExists ( mixed $key ) : boolean Checks whether the key exists
offsetGet ( mixed $key ) : array | boolean | null Normal $example[$key] access for the array
offsetSet ( mixed $key, mixed $value ) Normal $example[$key] = 'hello' access for the array
offsetUnset ( mixed $key ) Unsets the key
set ( string $key, string $value ) Object oriented set access for the array
setContent ( array $content ) Sets the resource contents

Protected Methods

Method Description
internalUnset ( array &$array, mixed $key ) Internal unset for the key

Private Methods

Method Description
internalGet ( array $array, mixed $key, boolean $exists = false ) : array | boolean | null The internal get function for getting values by their key
internalSet ( array &$array, mixed $key, mixed $value ) : array Object oriented set access for the array

Method Details

arrayKeyExists() public method

Port of array_key_exists to \ArrayAccess
public arrayKeyExists ( mixed $key ) : boolean
$key mixed The key to check if exists
return boolean Does the key exist

get() public method

Object oriented get access for the array
public get ( mixed $key ) : array | boolean | null
$key mixed The key to get the value for
return array | boolean | null The resource key value

getContent() public method

Returns the content of the resource
public getContent ( ) : array
return array The content

internalUnset() protected method

Internal unset for the key
protected internalUnset ( array &$array, mixed $key )
$array array The array to use -- will always be based on $this->content but can be used recursively
$key mixed The key to unset

offsetExists() public method

Checks whether the key exists
public offsetExists ( mixed $key ) : boolean
$key mixed The key to check
return boolean Does the key exist

offsetGet() public method

Normal $example[$key] access for the array
public offsetGet ( mixed $key ) : array | boolean | null
$key mixed The key to get the value for
return array | boolean | null The resource key value

offsetSet() public method

Normal $example[$key] = 'hello' access for the array
public offsetSet ( mixed $key, mixed $value )
$key mixed The key to set the value for
$value mixed The value to set

offsetUnset() public method

Unsets the key
public offsetUnset ( mixed $key )
$key mixed The key to unset

set() public method

Object oriented set access for the array
public set ( string $key, string $value )
$key string The key to set the value for
$value string The value to set

setContent() public method

Sets the resource contents
public setContent ( array $content )
$content array

Property Details

$content protected property

The resource content
protected array $content
return array