public function Context::contains in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/sebastian/recursion-context/src/Context.php \SebastianBergmann\RecursionContext\Context::contains()
Checks if the given value exists within the context.
Parameters
array|object $value The value to check.:
Return value
int|string|false The string or integer ID of the stored value if it has already been seen, or false if the value is not stored.
Throws
InvalidArgumentException Thrown if $value is not an array or object
File
- vendor/
sebastian/ recursion-context/ src/ Context.php, line 72
Class
- Context
- A context containing previously processed arrays and objects when recursively processing a value.
Namespace
SebastianBergmann\RecursionContextCode
public function contains(&$value) {
if (is_array($value)) {
return $this
->containsArray($value);
}
else {
if (is_object($value)) {
return $this
->containsObject($value);
}
}
throw new InvalidArgumentException('Only arrays and objects are supported');
}