Psecio\Gatekeeper\Gatekeeper::evaluatePolicy PHP Метод

evaluatePolicy() публичный статический Метод

Evaluate the policy (found by name) against the data provided
public static evaluatePolicy ( string $name, mixed $data ) : boolean
$name string Name of the policy
$data mixed Data to use in evaluation (single object or array)
Результат boolean Pass/fail status of evaluation
    public static function evaluatePolicy($name, $data)
    {
        // See if it's a closure policy first
        if (array_key_exists($name, self::$policies)) {
            $policy = self::$policies[$name];
            $result = $policy($data);
            return !is_bool($result) ? false : $result;
        } else {
            $policy = Gatekeeper::findPolicyByName($name);
            return $policy->evaluate($data);
        }
    }