RSI helpers  0.1
RSI helpers
Thing Class Reference

Basic object. More...

Inheritance diagram for Thing:
Dump Query Value

Public Member Functions

 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Basic object.

By making use of the magic getter and setter it is not necessary to define a specific getter and setter for every property upfront. All properties can be used as normal properties (that is: without using getXxx() and setXxx() functions). A property which first was public can be made private/protected, after which it is possible to use a specific getter and/or setter. Private properties can also be published, which makes it unnecessary to create a specic getter and/or setter.

Definition at line 13 of file Thing.php.

Member Function Documentation

◆ __get()

__get (   $key)

Definition at line 127 of file Thing.php.

◆ __set()

__set (   $key,
  $value 
)

Definition at line 131 of file Thing.php.

◆ _get()

_get (   $key)
protected

Default getter if no specific setter is defined, and the property is also not published (readable).

Parameters
string$keyName of the property.
Returns
mixed Value.

Definition at line 69 of file Thing.php.

◆ _set()

_set (   $key,
  $value 
)
protected

Default setter if no specific setter is defined, and the property is also not published (writeable).

Parameters
string$keyName of the property.
mixed$valueValue for the property.

Definition at line 77 of file Thing.php.

◆ configure()

configure (   $config)
protected

Configure the object.

This will also alter protected and read-only properties. If a specific setter exists it will be used.

Parameters
array$configArray with the configuration (key-value pairs).

Definition at line 45 of file Thing.php.

◆ constants()

constants (   $prefix = null)

Return all constants.

Parameters
string$prefixOnly constants starting with this prefix.
Returns
array Key = constant name (without prefix), value = constant value.

Definition at line 56 of file Thing.php.

◆ get()

get (   $key)

Get one or more properties.

Evaluation order:

  • public property.
  • specific setter.
  • published property.
  • default _get() function.
    See also
    _get()
    Parameters
    string | array$keyName of the property, or an array with keys.
    Returns
    mixed Value(s).

Definition at line 91 of file Thing.php.

◆ propertyExists()

propertyExists (   $property)

Check if a property exists (public or published).

Parameters
string$propertyName of the property.
Returns
bool True if the property exists.

Definition at line 37 of file Thing.php.

◆ publish()

publish (   $property,
  $visibility = self::READABLE 
)
protected

Publish a property (or hide it again).

Parameters
string | array$propertyName of the property, or an array with name-visibility pairs.
int$visibilityVisibility for the property (when a name is given). See the constants for possibilities.

Definition at line 27 of file Thing.php.

◆ set()

set (   $key,
  $value = null 
)

Set one or more properties.

Evaluation order:

  • public property.
  • specific setter.
  • published property.
  • default _set() function.
    See also
    _set()
    Parameters
    string | array$keyName of the property, or an assoc.array with key-value pairs.
    mixed$valueValue(s).

Definition at line 116 of file Thing.php.

Field Documentation

◆ $_published

$_published = []
protected

Published properties (key = name of property, value = visibility).

Definition at line 20 of file Thing.php.

◆ HIDDEN

const HIDDEN = 0

Property is hidden.

Definition at line 15 of file Thing.php.

◆ READABLE

const READABLE = 1

Property is readable.

Definition at line 16 of file Thing.php.

◆ READWRITE

const READWRITE = 3

Property is readable and writeable.

Definition at line 18 of file Thing.php.

◆ WRITEABLE

const WRITEABLE = 2

Property is writeable.

Definition at line 17 of file Thing.php.


The documentation for this class was generated from the following file: