Class JData

Description

Implements interfaces:

JData is a class that is used to store data but allowing you to access the data by mimicking the way PHP handles class properties.

  • since: 12.3

Located in /libraries/joomla/data/data.php (line 20)


	
			
Method Summary
 JData __construct ([mixed $properties = array()])
 JData bind (mixed $properties, [boolean $updateNulls = true])
 integer count ()
 stdClass dump ([integer $depth = 3], [SplObjectStorage $dumped = null])
 mixed dumpProperty (string $property, integer $depth, SplObjectStorage $dumped)
 ArrayIterator getIterator ()
 mixed getProperty (string $property)
 string jsonSerialize ()
 mixed setProperty (string $property, mixed $value)
 mixed __get (string $property)
 boolean __isset (string $property)
 void __set (string $property, mixed $value)
 void __unset (string $property)
Methods
Constructor __construct (line 39)

The class constructor.

  • since: 12.3
  • throws: InvalidArgumentException
  • access: public
JData __construct ([mixed $properties = array()])
  • mixed $properties: Either an associative array or another object by which to set the initial properties of the new object.
bind (line 128)

Binds an array or object to this object.

  • return: Returns itself to allow chaining.
  • since: 12.3
  • throws: InvalidArgumentException
  • access: public
JData bind (mixed $properties, [boolean $updateNulls = true])
  • mixed $properties: An associative array of properties or an object.
  • boolean $updateNulls: True to bind null values, false to ignore null values.
count (line 328)

Count the number of data properties.

  • return: The number of data properties.
  • since: 12.3
  • access: public
integer count ()

Implementation of:
Countable::count
dump (line 177)

Dumps the data properties into a stdClass object, recursively if appropriate.

  • return: The data properties as a simple PHP stdClass object.
  • since: 12.3
  • access: public
stdClass dump ([integer $depth = 3], [SplObjectStorage $dumped = null])
  • integer $depth: The maximum depth of recursion (default = 3). For example, a depth of 0 will return a stdClass with all the properties in native form. A depth of 1 will recurse into the first level of properties only.
  • SplObjectStorage $dumped: An array of already serialized objects that is used to avoid infinite loops.

Implementation of:
JDataDumpable::dump()
Dumps the object properties into a stdClass object, recursively if appropriate.
dumpProperty (line 242)

Dumps a data property.

If recursion is set, this method will dump any object implementing JDumpable (like JData and JDataSet); it will convert a JDate object to a string; and it will convert a JRegistry to an object.

  • return: The value of the dumped property.
  • since: 12.3
  • access: protected
mixed dumpProperty (string $property, integer $depth, SplObjectStorage $dumped)
  • string $property: The name of the data property.
  • integer $depth: The current depth of recursion (a value of 0 will ignore recursion).
  • SplObjectStorage $dumped: An array of already serialized objects that is used to avoid infinite loops.
getIterator (line 211)

Gets this object represented as an ArrayIterator.

This allows the data properties to be access via a foreach statement.

  • return: This object represented as an ArrayIterator.
  • see: IteratorAggregate::getIterator()
  • since: 12.3
  • access: public
ArrayIterator getIterator ()

Implementation of:
IteratorAggregate::getIterator
getProperty (line 283)

Gets a data property.

  • return: The value of the data property.
  • see: JData::__get()
  • since: 12.3
  • access: protected
mixed getProperty (string $property)
  • string $property: The name of the data property.
jsonSerialize (line 223)

Gets the data properties in a form that can be serialised to JSON format.

  • return: An object that can be serialised by json_encode().
  • since: 12.3
  • access: public
string jsonSerialize ()

Implementation of:
JsonSerializable::jsonSerialize
setProperty (line 304)

Sets a data property.

If the name of the property starts with a null byte, this method will return null.

  • return: The value of the data property.
  • see: JData::__set()
  • since: 12.3
  • access: protected
mixed setProperty (string $property, mixed $value)
  • string $property: The name of the data property.
  • mixed $value: The value to give the data property.
__get (line 66)

The magic get method is used to get a data property.

This method is a public proxy for the protected getProperty method.

Note: Magic __get does not allow recursive calls. This can be tricky because the error generated by recursing into __get is "Undefined property: {CLASS}::{PROPERTY}" which is misleading. This is relevant for this class because requesting a non-visible property can trigger a call to a sub-function. If that references the property directly in the object, it will cause a recursion into __get.

  • return: The value of the data property, or null if the data property does not exist.
  • see: JData::getProperty()
  • since: 12.3
  • access: public
mixed __get (string $property)
  • string $property: The name of the data property.
__isset (line 80)

The magic isset method is used to check the state of an object property.

  • return: True if set, otherwise false is returned.
  • since: 12.3
  • access: public
boolean __isset (string $property)
  • string $property: The name of the data property.
__set (line 98)

The magic set method is used to set a data property.

This is a public proxy for the protected setProperty method.

void __set (string $property, mixed $value)
  • string $property: The name of the data property.
  • mixed $value: The value to give the data property.
__unset (line 112)

The magic unset method is used to unset a data property.

  • since: 12.3
  • access: public
void __unset (string $property)
  • string $property: The name of the data property.

Documentation generated on Tue, 19 Nov 2013 14:57:46 +0100 by phpDocumentor 1.4.3