ProtectedContext
class ProtectedContext extends Context (View source)
A protected evaluation context
- Access to public properties and array is allowed
- Methods have to be allowed
Properties
protected mixed | $value | from Context | |
protected array | $allowedMethods |
Methods
Get a value by path and wrap it into another context
Call a method if it is allowed
Call a method and wrap the result
Allow the given method (or array of methods) for calls
Allow the given method (or array of methods) for calls
Details
__construct(mixed $value = null)
No description
mixed
get(string|int|Context $path)
Get a value of the context
This basically acts as a safe access to non-existing properties, unified array and property access (using getters) and access to the current value (empty path).
If a property or key did not exist this method will return NULL.
Context
getAndWrap(string $path = null)
Get a value by path and wrap it into another context
The list of allowed methods for the given path is applied to the new context.
mixed
call(string $method, array $arguments = [])
Call a method if it is allowed
mixed
callAndWrap(string $method, array $arguments = [])
Call a method and wrap the result
Context
wrap(mixed $value)
Wraps the given value in a new Context
mixed
unwrap()
Unwrap the context value recursively
mixed
unwrapValue($value)
Unwrap a value by unwrapping nested context objects
This method is public for closure access.
Context
push(mixed $value, string $key = null)
Push an entry to the context
Is used to build array instances inside the evaluator.
string
__toString()
No description
void
whitelist(array|string $pathOrMethods)
deprecated
deprecated
Allow the given method (or array of methods) for calls
Method can be allowed on the root level of the context or for arbitrary paths. A special method "*" will allow all methods to be called.
Examples:
$context->allow('myMethod');
$context->allow('*');
$context->allow(array('String.*', 'Array.reverse'));
void
allow(array|string $pathOrMethods)
Allow the given method (or array of methods) for calls
Method can be allowed on the root level of the context or for arbitrary paths. A special method "*" will allow all methods to be called.
Examples:
$context->allow('myMethod');
$context->allow('*');
$context->allow(array('String.*', 'Array.reverse'));