protected function createRules()
    {
        $rules = [];
        foreach ($this->rules as $key => $rule) {
            if (!is_array($rule)) {
                $verbs = 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS';
                $verb = null;
                if (preg_match("/^((?:(?:$verbs),)*(?:$verbs))\\s+(.*)$/", $key, $matches)) {
                    $verb = explode(',', $matches[1]);
                    $key = $matches[2];
                }
                $rule = [
                    'pattern' => ltrim($this->prefix . '/' . $key, '/'),
                    'route' => ltrim($this->routePrefix . '/' . $rule, '/'),
                    'verb' => $verb
                ];
            } elseif (isset($rule['pattern'], $rule['route'])) {
                $rule['pattern'] = ltrim($this->prefix . '/' . $rule['pattern'], '/');
                $rule['route'] = ltrim($this->routePrefix . '/' . $rule['route'], '/');
            }

            $rule = Yii::createObject(array_merge($this->ruleConfig, $rule));
            if (!$rule instanceof UrlRuleInterface) {
                throw new InvalidConfigException('URL rule class must implement UrlRuleInterface.');
            }
            $rules[] = $rule;
        }

        return $rules;
    }
protected function createRules()
    {
        $rules = [];
        foreach ($this->rules as $key => $rule) {
            if (!is_array($rule)) {
                $verbs = 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS';
                $verb = null;
                if (preg_match("/^((?:(?:$verbs),)*(?:$verbs))\\s+(.*)$/", $key, $matches)) {
                    $verb = explode(',', $matches[1]);
                    $key = $matches[2];
                }
                $rule = [
                    'pattern' => ltrim($this->prefix . '/' . $key, '/'),
                    'route' => ltrim($this->routePrefix . '/' . $rule, '/'),
                    'verb' => $verb
                ];
            } elseif (isset($rule['pattern'], $rule['route'])) {
                $rule['pattern'] = ltrim($this->prefix . '/' . $rule['pattern'], '/');
                $rule['route'] = ltrim($this->routePrefix . '/' . $rule['route'], '/');
            }

            $rule = Yii::createObject(array_merge($this->ruleConfig, $rule));
            if (!$rule instanceof UrlRuleInterface) {
                throw new InvalidConfigException('URL rule class must implement UrlRuleInterface.');
            }
            $rules[] = $rule;
        }

        return $rules;
    }
protected function createRules ( ) { $ rules = [ ] ; foreach ( $ this -> rules as $ key => $ rule ) { if ( ! is_array ( $ rule ) ) { $ verbs = 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS' ; $ verb = null ; if ( preg_match ( "/^((?:(?:$verbs),)*(?:$verbs))\\s+(.*)$/" , $ key , $ matches ) ) { $ verb = explode ( ',' , $ matches [ 1 ] ) ; $ key = $ matches [ 2 ] ; } $ rule = [ 'pattern' => ltrim ( $ this -> prefix . '/' . $ key , '/' ) , 'route' => ltrim ( $ this -> routePrefix . '/' . $ rule , '/' ) , 'verb' => $ verb ] ; } elseif ( isset ( $ rule [ 'pattern' ] , $ rule [ 'route' ] ) ) { $ rule [ 'pattern' ] = ltrim ( $ this -> prefix . '/' . $ rule [ 'pattern' ] , '/' ) ; $ rule [ 'route' ] = ltrim ( $ this -> routePrefix . '/' . $ rule [ 'route' ] , '/' ) ; } $ rule = Yii :: createObject ( array_merge ( $ this -> ruleConfig , $ rule ) ) ; if ( ! $ rule instanceof UrlRuleInterface ) { throw new InvalidConfigException ( 'URL rule class must implement UrlRuleInterface.' ) ; } $ rules [ ] = $ rule ; } return $ rules ; }
{@inheritdoc}
{