Psecio\PropAuth\Enforcer::allows PHP Method

allows() public method

Locate a policy by key name and determine if the subject is allowed by matching against its properties
public allows ( string $policyName, object $subject, array $addl = [] ) : boolean
$policyName string Policy name to evaluate
$subject object Subject to evaluate against
$addl array
return boolean Pass/fail result of evaluation
    public function allows($policyName, $subject, array $addl = array())
    {
        if (!is_array($policyName)) {
            $policyName = [$policyName];
        }
        foreach ($policyName as $name) {
            if (!isset($this->policySet[$name])) {
                throw new \InvalidArgumentException('Policy name "' . $name . '" not found');
            }
            $result = $this->evaluate($subject, $this->policySet[$name], $addl);
            if ($result === false) {
                return false;
            }
        }
        return true;
    }