yii\filters\auth\AuthMethod::isOptional PHP Method

isOptional() protected method

Checks, whether authentication is optional for the given action.
See also: optional
Since: 2.0.7
protected isOptional ( Action $action ) : boolean
$action yii\base\Action action to be checked.
return boolean whether authentication is optional or not.
    protected function isOptional($action)
    {
        $id = $this->getActionId($action);
        foreach ($this->optional as $pattern) {
            if (fnmatch($pattern, $id)) {
                return true;
            }
        }
        return false;
    }