[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/data/src/ -> DataObject.php (summary)

Part of the Joomla Framework Data Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 326 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

DataObject:: (13 methods):
  __construct()
  __get()
  __isset()
  __set()
  __unset()
  bind()
  dump()
  getIterator()
  jsonSerialize()
  dumpProperty()
  getProperty()
  setProperty()
  count()


Class: DataObject  - X-Ref

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

__construct($properties = [])   X-Ref
The class constructor.

param: mixed  $properties  Either an associative array or another object by which to set the initial properties of the new object.

__get($property)   X-Ref
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.

param: string  $property  The name of the data property.
return: mixed  The value of the data property, or null if the data property does not exist.

__isset($property)   X-Ref
The magic isset method is used to check the state of an object property.

param: string  $property  The name of the data property.
return: boolean

__set($property, $value)   X-Ref
The magic set method is used to set a data property.

This is a public proxy for the protected setProperty method.

param: string  $property  The name of the data property.
param: mixed   $value     The value to give the data property.
return: void

__unset($property)   X-Ref
The magic unset method is used to unset a data property.

param: string  $property  The name of the data property.
return: void

bind($properties, $updateNulls = true)   X-Ref
Binds an array or object to this object.

param: mixed    $properties   An associative array of properties or an object.
param: boolean  $updateNulls  True to bind null values, false to ignore null values.
return: $this

dump($depth = 3, \SplObjectStorage $dumped = null)   X-Ref
Dumps the data properties into an object, recursively if appropriate.

param: integer            $depth   The maximum depth of recursion (default = 3).
param: \SplObjectStorage  $dumped  An array of already serialized objects that is used to avoid infinite loops.
return: \stdClass

getIterator()   X-Ref
Gets this object represented as an ArrayIterator.

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

return: \ArrayIterator

jsonSerialize()   X-Ref
Gets the data properties in a form that can be serialised to JSON format.

return: string

dumpProperty($property, $depth, \SplObjectStorage $dumped)   X-Ref
Dumps a data property.

If recursion is set, this method will dump any object implementing DumpableInterface (like DataObject and DataSet); it will
convert a DateTimeInterface object to a string; and it will convert a Joomla\Registry\Registry to an object.

param: string             $property  The name of the data property.
param: integer            $depth     The current depth of recursion (a value of 0 will ignore recursion).
param: \SplObjectStorage  $dumped    An array of already serialized objects that is used to avoid infinite loops.
return: mixed  The value of the dumped property.

getProperty($property)   X-Ref
Gets a data property.

param: string  $property  The name of the data property.
return: mixed  The value of the data property.

setProperty($property, $value)   X-Ref
Sets a data property.

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

param: string  $property  The name of the data property.
param: mixed   $value     The value to give the data property.
return: mixed  The value of the data property.

count()   X-Ref
Count the number of data properties.

return: integer  The number of data properties.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer