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

__construct(mixed $value = null)

No description

from  Context
mixed
get(string|int|Context $path)

Get a value of the context

from  Context
getAndWrap(string $path = null)

Get a value by path and wrap it into another 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

from  Context
wrap(mixed $value)

Wraps the given value in a new Context

from  Context
mixed
unwrap()

Unwrap the context value recursively

from  Context
mixed
unwrapValue($value)

Unwrap a value by unwrapping nested context objects

from  Context
push(mixed $value, string $key = null)

Push an entry to the context

from  Context
string
__toString()

No description

from  Context
void
whitelist(array|string $pathOrMethods) deprecated

Allow the given method (or array of methods) for calls

void
allow(array|string $pathOrMethods)

Allow the given method (or array of methods) for calls

Details

__construct(mixed $value = null)

No description

Parameters

mixed $value

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.

Parameters

string|int|Context $path

The path as string or Context value, will be unwrapped for convenience

Return Value

mixed

The value

Exceptions

EvaluationException

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.

Parameters

string $path

Return Value

Context

The wrapped value

mixed call(string $method, array $arguments = [])

Call a method if it is allowed

Parameters

string $method
array $arguments

Arguments to the method, if of type Context they will be unwrapped

Return Value

mixed

Exceptions

NotAllowedException

mixed callAndWrap(string $method, array $arguments = [])

Call a method and wrap the result

Parameters

string $method
array $arguments

Return Value

mixed

Context wrap(mixed $value)

Wraps the given value in a new Context

Parameters

mixed $value

Return Value

Context

mixed unwrap()

Unwrap the context value recursively

Return Value

mixed

mixed unwrapValue($value)

Unwrap a value by unwrapping nested context objects

This method is public for closure access.

Parameters

$value

Return Value

mixed

Context push(mixed $value, string $key = null)

Push an entry to the context

Is used to build array instances inside the evaluator.

Parameters

mixed $value
string $key

Return Value

Context

Exceptions

EvaluationException

string __toString()

No description

Return Value

string

void whitelist(array|string $pathOrMethods) deprecated

deprecated Use allow() instead. See https://github.com/neos/flow-development-collection/pull/2024

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'));

Parameters

array|string $pathOrMethods

Return Value

void

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'));

Parameters

array|string $pathOrMethods

Return Value

void