li3_access\extensions\adapter\security\access\Rules::_call PHP Method

_call() protected method

Extracts a callable rule either from a rule definition assigned as a closure, or a string reference to a rule defined in a key in the $_rules array.
protected _call ( array $rule, mixed $user, mixed $request, array $options ) : boolean
$rule array The rule definition array.
$user mixed The value representing the user making the request. Usually an array.
$request mixed The value representing request data or the object being access.
$options array Any options passed to `check()`.
return boolean Returns `true` if the call to the rule was successful, otherwise `false` if the call failed, or if a callable rule was not found.
    protected function _call($rule, $user, $request, array $options)
    {
        $callable = null;
        switch (true) {
            case is_callable($rule['rule']):
                $callable = $rule['rule'];
                break;
            case in_array($rule['rule'], array_keys($this->_rules)):
                $callable = $this->_rules[$rule['rule']];
                break;
        }
        return $callable ? call_user_func($callable, $user, $request, $rule + $options) : false;
    }