Liste de tous les membres
Fonctions membres privées |
| _initialise (array $input=array()) |
Description détaillée
Définition à la ligne 20 du fichier set.php.
Documentation des constructeurs et destructeur
JDataSet::__construct |
( |
array |
$objects = array() | ) |
|
The class constructor.
- Paramètres:
-
array | $objects | An array of JData objects to bind to the data set. |
- Depuis:
- 12.3
- Exceptions:
-
InvalidArgumentException | if an object is not an instance of JData. |
Définition à la ligne 46 du fichier set.php.
Documentation des fonctions membres
JDataSet::__call |
( |
|
$method, |
|
|
|
$arguments = array() |
|
) |
| |
The magic call method is used to call object methods using the iterator.
Example: $array = $objectList->foo('bar');
The object list will iterate over its objects and see if each object has a callable 'foo' method. If so, it will pass the argument list and assemble any return values. If an object does not have a callable method no return value is recorded. The keys of the objects and the result array are maintained.
- Paramètres:
-
string | $method | The name of the method called. |
array | $arguments | The arguments of the method called. |
- Renvoie:
- array An array of values returned by the methods called on the objects in the data set.
- Depuis:
- 12.3
Définition à la ligne 69 du fichier set.php.
{
$return = array();
foreach ($this->_objects as $key => $object)
{
$callback = array($object, $method);
if (is_callable($callback))
{
$return[$key] = call_user_func_array($callback, $arguments);
}
}
return $return;
}
JDataSet::__get |
( |
|
$property | ) |
|
The magic get method is used to get a list of properties from the objects in the data set.
Example: $array = $dataSet->foo;
This will return a column of the values of the 'foo' property in all the objects (or values determined by custom property setters in the individual JData's). The result array will contain an entry for each object in the list (compared to __call which may not). The keys of the objects and the result array are maintained.
- Paramètres:
-
string | $property | The name of the data property. |
- Renvoie:
- array An associative array of the values.
- Depuis:
- 12.3
Définition à la ligne 106 du fichier set.php.
{
$return = array();
foreach ($this->_objects as $key => $object)
{
$return[$key] = $object->$property;
}
return $return;
}
JDataSet::__isset |
( |
|
$property | ) |
|
The magic isset method is used to check the state of an object property using the iterator.
Example: $array = isset($objectList->foo);
- Paramètres:
-
string | $property | The name of the property. |
- Renvoie:
- boolean True if the property is set in any of the objects in the data set.
- Depuis:
- 12.3
Définition à la ligne 131 du fichier set.php.
{
$return = array();
foreach ($this->_objects as $object)
{
$return[] = isset($object->$property);
}
return in_array(true, $return, true) ? true : false;
}
JDataSet::__set |
( |
|
$property, |
|
|
|
$value |
|
) |
| |
The magic set method is used to set an object property using the iterator.
Example: $objectList->foo = 'bar';
This will set the 'foo' property to 'bar' in all of the objects (or a value determined by custom property setters in the JData).
- Paramètres:
-
string | $property | The name of the property. |
mixed | $value | The value to give the data property. |
- Renvoie:
- void
- Depuis:
- 12.3
Définition à la ligne 160 du fichier set.php.
{
foreach ($this->_objects as $object)
{
$object->$property = $value;
}
}
JDataSet::__unset |
( |
|
$property | ) |
|
The magic unset method is used to unset an object property using the iterator.
Example: unset($objectList->foo);
This will unset all of the 'foo' properties in the list of JData's.
- Paramètres:
-
string | $property | The name of the property. |
- Renvoie:
- void
- Depuis:
- 12.3
Définition à la ligne 183 du fichier set.php.
{
foreach ($this->_objects as $object)
{
unset($object->$property);
}
}
JDataSet::_initialise |
( |
array |
$input = array() | ) |
|
|
private |
Initialises the list with an array of objects.
- Paramètres:
-
array | $input | An array of objects. |
- Renvoie:
- void
- Depuis:
- 12.3
- Exceptions:
-
InvalidArgumentException | if an object is not an instance of JData. |
Définition à la ligne 506 du fichier set.php.
{
foreach ($input as $key => $object)
{
if (!is_null($object))
{
}
}
}
Clears the objects in the data set.
- Renvoie:
- JDataSet Returns itself to allow chaining.
- Depuis:
- 12.3
Définition à la ligne 211 du fichier set.php.
{
$this->_objects = array();
return $this;
}
Gets the number of data objects in the set.
- Renvoie:
- integer The number of objects.
- Depuis:
- 12.3
Définition à la ligne 199 du fichier set.php.
{
return count($this->_objects);
}
Get the current data object in the set.
- Renvoie:
- JData The current object, or false if the array is empty or the pointer is beyond the end of the elements.
- Depuis:
- 12.3
Définition à la ligne 226 du fichier set.php.
{
return is_scalar($this->_current) ? $this->_objects[
$this->_current] :
false;
}
JDataSet::dump |
( |
|
$depth = 3 , |
|
|
SplObjectStorage |
$dumped = null |
|
) |
| |
Dumps the data object in the set, recursively if appropriate.
- Paramètres:
-
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. |
- Renvoie:
- array An associative array of the date objects in the set, dumped as a simple PHP stdClass object.
- Voir également:
- JData::dump()
- Depuis:
- 12.3
Implémente JDataDumpable.
Définition à la ligne 244 du fichier set.php.
{
if ($dumped === null)
{
$dumped = new SplObjectStorage;
}
$dumped->attach($this);
$objects = array();
if ($depth > 0)
{
foreach ($this->_objects as $key => $object)
{
$objects[$key] = $object->dump($depth, $dumped);
}
}
return $objects;
}
JDataSet::jsonSerialize |
( |
|
$serialized = null | ) |
|
Gets the data set in a form that can be serialised to JSON format.
Note that this method will not return an associative array, otherwise it would be encoded into an object. JSON decoders do not consistently maintain the order of associative keys, whereas they do maintain the order of arrays.
- Paramètres:
-
mixed | $serialized | An array of objects that have already been serialized that is used to infinite loops (null on first call). |
- Renvoie:
- array An array that can be serialised by json_encode().
- Depuis:
- 12.3
Définition à la ligne 283 du fichier set.php.
{
if ($serialized === null)
{
$serialized = array();
}
$serialized[] = spl_object_hash($this);
$return = array();
foreach ($this->_objects as $object)
{
$return[] = $object->jsonSerialize($serialized);
}
return $return;
}
Gets the key of the current object in the iterator.
- Renvoie:
- scalar The object key on success; null on failure.
- Depuis:
- 12.3
Définition à la ligne 312 du fichier set.php.
Gets the array of keys for all the objects in the iterator (emulates array_keys).
- Renvoie:
- array The array of keys
- Depuis:
- 12.3
Définition à la ligne 324 du fichier set.php.
{
return array_keys($this->_objects);
}
Advances the iterator to the next object in the iterator.
- Renvoie:
- void
- Depuis:
- 12.3
Définition à la ligne 336 du fichier set.php.
{
if ($this->_current === false && isset($keys[0]))
{
$this->_current = $keys[0];
}
else
{
$position = array_search($this->_current, $keys);
if ($position !== false && isset($keys[$position + 1]))
{
$this->_current = $keys[$position + 1];
}
else
{
$this->_current = null;
}
}
}
JDataSet::offsetExists |
( |
|
$offset | ) |
|
Checks whether an offset exists in the iterator.
- Paramètres:
-
mixed | $offset | The object offset. |
- Renvoie:
- boolean True if the object exists, false otherwise.
- Depuis:
- 12.3
Définition à la ligne 375 du fichier set.php.
{
return isset($this->_objects[$offset]);
}
JDataSet::offsetGet |
( |
|
$offset | ) |
|
Gets an offset in the iterator.
- Paramètres:
-
mixed | $offset | The object offset. |
- Renvoie:
- JData The object if it exists, null otherwise.
- Depuis:
- 12.3
Définition à la ligne 389 du fichier set.php.
{
return isset($this->_objects[$offset]) ? $this->_objects[$offset] : null;
}
JDataSet::offsetSet |
( |
|
$offset, |
|
|
|
$object |
|
) |
| |
Sets an offset in the iterator.
- Paramètres:
-
mixed | $offset | The object offset. |
JData | $object | The object object. |
- Renvoie:
- void
- Depuis:
- 12.3
- Exceptions:
-
InvalidArgumentException | if an object is not an instance of JData. |
Définition à la ligne 405 du fichier set.php.
{
if (!($object instanceof
JData))
{
throw new InvalidArgumentException(sprintf('%s("%s", *%s*)', __METHOD__, $offset, gettype($object)));
}
$this->_objects[$offset] = $object;
}
JDataSet::offsetUnset |
( |
|
$offset | ) |
|
Unsets an offset in the iterator.
- Paramètres:
-
mixed | $offset | The object offset. |
- Renvoie:
- void
- Depuis:
- 12.3
Définition à la ligne 426 du fichier set.php.
{
{
return;
}
if ($offset == $this->_current)
{
$position = array_search($this->_current, $keys);
if ($position > 0)
{
$this->_current = $keys[$position - 1];
}
else
{
$this->_current = false;
}
}
unset($this->_objects[$offset]);
}
Rewinds the iterator to the first object.
- Renvoie:
- void
- Depuis:
- 12.3
Définition à la ligne 464 du fichier set.php.
{
if (empty($this->_objects))
{
$this->_current = false;
}
else
{
$this->_current = array_shift($keys);
}
}
Validates the iterator.
- Renvoie:
- boolean True if valid, false otherwise.
- Depuis:
- 12.3
Définition à la ligne 485 du fichier set.php.
{
if (!is_scalar($this->_current) || !isset($this->_objects[$this->_current]))
{
return false;
}
return true;
}
Documentation des données membres
JDataSet::$_current = false |
|
private |
JDataSet::$_objects = array() |
|
private |
La documentation de cette classe a été générée à partir du fichier suivant :