Evaluator

The evaluator service is a simple class that recursively resolves values from a mixed target.

Basic Usage

You can evaluate your values by using the \Anomaly\Streams\Platform\Support\Evaluator class.

Evaluator::evaluate()

The evaluate method evaluates a mixed value.

Returns: mixed
Arguments
Key Required Type Default Description

$target

true

mixed

none

The value to evaluate.

$arguments

false

array

null

The arguments to pass to the value resolvers.

Example
$entry = new Person(['name' =>'Ryan']);

$evaluator->evaluate('{entry.name}', compact('entry')); // Ryan

$evaluator->evaluate(
    function($entry) {
        return $entry->name;
    },
    compact('entry')
); // Ryan