yii\base\ActionFilter::isActive PHP 메소드

isActive() 보호된 메소드

Returns a value indicating whether the filter is active for the given action.
protected isActive ( Action $action ) : boolean
$action Action the action being filtered
리턴 boolean whether the filter is active for the given action.
    protected function isActive($action)
    {
        $id = $this->getActionId($action);
        if (empty($this->only)) {
            $onlyMatch = true;
        } else {
            $onlyMatch = false;
            foreach ($this->only as $pattern) {
                if (fnmatch($pattern, $id)) {
                    $onlyMatch = true;
                    break;
                }
            }
        }
        $exceptMatch = false;
        foreach ($this->except as $pattern) {
            if (fnmatch($pattern, $id)) {
                $exceptMatch = true;
                break;
            }
        }
        return !$exceptMatch && $onlyMatch;
    }

Usage Example

예제 #1
0
파일: AuthMethod.php 프로젝트: Kest007/yii2
 /**
  * {@inheritdoc}
  */
 protected function isActive($action)
 {
     return parent::isActive($action) || $this->isOptional($action);
 }