code: protected function buildRules($ruleDeclarations)
      {
          $builtRules = $this->getBuiltRulesFromCache($ruleDeclarations);
          if ($builtRules !== false) {
              return $builtRules;
          }
  
          $builtRules = [];
          $verbs = 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS';
          foreach ($ruleDeclarations as $key => $rule) {
              if (is_string($rule)) {
                  $rule = ['route' => $rule];
                  if (preg_match("/^((?:($verbs),)*($verbs))\\s+(.*)$/", $key, $matches)) {
                      $rule['verb'] = explode(',', $matches[1]);
                      // rules that are not applicable for GET requests should not be used to create URLs
                      if (!in_array('GET', $rule['verb'], true)) {
                          $rule['mode'] = UrlRule::PARSING_ONLY;
                      }
                      $key = $matches[4];
                  }
                  $rule['pattern'] = $key;
              }
              if (is_array($rule)) {
                  $rule = Yii::createObject(array_merge($this->ruleConfig, $rule));
              }
              if (!$rule instanceof UrlRuleInterface) {
                  throw new InvalidConfigException('URL rule class must implement UrlRuleInterface.');
              }
              $builtRules[] = $rule;
          }
  
          $this->setBuiltRulesCache($ruleDeclarations, $builtRules);
  
          return $builtRules;
      }
docs: Builds URL rule objects from the given rule declarations.
  
  @param array $ruleDeclarations the rule declarations. Each array element represents a single rule declaration.
  Please refer to [[rules]] for the acceptable rule formats.
  @return UrlRuleInterface[] the rule objects built from the given rule declarations
  @throws InvalidConfigException if a rule declaration is invalid