public function Context::add in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/sebastian/recursion-context/src/Context.php \SebastianBergmann\RecursionContext\Context::add()
Adds a value to the context.
Parameters
array|object $value The value to add.:
Return value
int|string The ID of the stored value, either as a string or integer.
Throws
InvalidArgumentException Thrown if $value is not an array or object
File
- vendor/
sebastian/ recursion-context/ src/ Context.php, line 47
Class
- Context
- A context containing previously processed arrays and objects when recursively processing a value.
Namespace
SebastianBergmann\RecursionContextCode
public function add(&$value) {
if (is_array($value)) {
return $this
->addArray($value);
}
else {
if (is_object($value)) {
return $this
->addObject($value);
}
}
throw new InvalidArgumentException('Only arrays and objects are supported');
}