public function get($path)
{
if ($path instanceof Context) {
$path = $path->unwrap();
}
if ($path === null) {
return null;
} elseif (is_string($path) || is_integer($path)) {
if (is_array($this->value)) {
return array_key_exists($path, $this->value) ? $this->value[$path] : null;
} elseif (is_object($this->value)) {
try {
return ObjectAccess::getProperty($this->value, $path);
} catch (PropertyNotAccessibleException $exception) {
return null;
}
}
} else {
throw new EvaluationException('Path is not of type string or integer, got ' . gettype($path), 1344418464);
}
}