original_string: public static function showRoute($rule, $echo = false, $showPattern = false)
      {
          $result = '';
          switch ($rule::className()) {
              case WebUrlRule::className():
                  $result .= ''
                     . "'" . htmlspecialchars($rule->name) . "'"
                     . ($showPattern ? " (" . htmlspecialchars($rule->pattern) . ")" : '')
                     . " => '" . htmlspecialchars($rule->route) . "'"
                     . " ({$rule::className()})"
                     . "\n"
                     ;
                  break;
              case GroupUrlRule::className():
                  $result .= "'{$rule->prefix}/...' ({$rule::className()}): <br>";
                  foreach ($rule->rules as $singleRule) {
                      $result .= static::$ruleShift
                         . "'" . htmlspecialchars($singleRule->name) . "'"
                         . ($showPattern ? " (" . htmlspecialchars($singleRule->pattern) . ")" : '')
                         . ' => '
                         . "'" . htmlspecialchars($singleRule->route) . "'"
                         . "\n"
                         ;
                  }
                  break;
              case RestUrlRule::className():
                  if (is_array($rule->controller)) {
                      //foreach ($rule->controller as $urlPrefix => $controller) break;
                      $urlPrefix = array_keys($rule->controller)[0];
                      $controller = $rule->controller[$urlPrefix];
                  } else {
                      $controller = $rule->controller;
                      $urlPrefix = '';
                  }
                  $result .= "'{$rule->prefix}/{$urlPrefix}/...' ({$rule::className()}): <br>";
                  foreach ($rule->patterns as $template => $action) {
                      $result .= static::$ruleShift
                         . "'" . $rule->prefix
                         . '/' . $urlPrefix . '/'
                         . htmlspecialchars($template) . htmlspecialchars($rule->suffix) . "'"
                         . " => '" . $controller . '/' . htmlspecialchars($action) . "'"
                         . "\n"
                         ;
                  }
                  break;
              default:
                  $result .= "{$rule::className()}:<br>";
                  if (method_exists($rule, 'showRouteInfo')) {
                      $info = $rule->showRouteInfo($showPattern);
                      $strings = explode("\n", trim($info));
                      foreach ($strings as $str) $result .= static::$ruleShift . trim($str) . "\n";
                  } else {
                      ob_start();
                      ob_implicit_flush(false);
                      var_dump($rule);
                      $result .= ob_get_clean();
                  }
                  break;
          }
          if ($echo) {
             echo $result;
          } else {
             return $result;
          }
      }
code: public static function showRoute($rule, $echo = false, $showPattern = false)
      {
          $result = '';
          switch ($rule::className()) {
              case WebUrlRule::className():
                  $result .= ''
                     . "'" . htmlspecialchars($rule->name) . "'"
                     . ($showPattern ? " (" . htmlspecialchars($rule->pattern) . ")" : '')
                     . " => '" . htmlspecialchars($rule->route) . "'"
                     . " ({$rule::className()})"
                     . "\n"
                     ;
                  break;
              case GroupUrlRule::className():
                  $result .= "'{$rule->prefix}/...' ({$rule::className()}): <br>";
                  foreach ($rule->rules as $singleRule) {
                      $result .= static::$ruleShift
                         . "'" . htmlspecialchars($singleRule->name) . "'"
                         . ($showPattern ? " (" . htmlspecialchars($singleRule->pattern) . ")" : '')
                         . ' => '
                         . "'" . htmlspecialchars($singleRule->route) . "'"
                         . "\n"
                         ;
                  }
                  break;
              case RestUrlRule::className():
                  if (is_array($rule->controller)) {
                      //foreach ($rule->controller as $urlPrefix => $controller) break;
                      $urlPrefix = array_keys($rule->controller)[0];
                      $controller = $rule->controller[$urlPrefix];
                  } else {
                      $controller = $rule->controller;
                      $urlPrefix = '';
                  }
                  $result .= "'{$rule->prefix}/{$urlPrefix}/...' ({$rule::className()}): <br>";
                  foreach ($rule->patterns as $template => $action) {
                      $result .= static::$ruleShift
                         . "'" . $rule->prefix
                         . '/' . $urlPrefix . '/'
                         . htmlspecialchars($template) . htmlspecialchars($rule->suffix) . "'"
                         . " => '" . $controller . '/' . htmlspecialchars($action) . "'"
                         . "\n"
                         ;
                  }
                  break;
              default:
                  $result .= "{$rule::className()}:<br>";
                  if (method_exists($rule, 'showRouteInfo')) {
                      $info = $rule->showRouteInfo($showPattern);
                      $strings = explode("\n", trim($info));
                      foreach ($strings as $str) $result .= static::$ruleShift . trim($str) . "\n";
                  } else {
                      ob_start();
                      ob_implicit_flush(false);
                      var_dump($rule);
                      $result .= ob_get_clean();
                  }
                  break;
          }
          if ($echo) {
             echo $result;
          } else {
             return $result;
          }
      }
code_tokens: public static function showRoute ( $ rule , $ echo = false , $ showPattern = false ) { $ result = '' ; switch ( $ rule :: className ( ) ) { case WebUrlRule :: className ( ) : $ result .= '' . "'" . htmlspecialchars ( $ rule -> name ) . "'" . ( $ showPattern ? " (" . htmlspecialchars ( $ rule -> pattern ) . ")" : '' ) . " => '" . htmlspecialchars ( $ rule -> route ) . "'" . " ({$rule::className()})" . "\n" ; break ; case GroupUrlRule :: className ( ) : $ result .= "'{$rule->prefix}/...' ({$rule::className()}): <br>" ; foreach ( $ rule -> rules as $ singleRule ) { $ result .= static :: $ ruleShift . "'" . htmlspecialchars ( $ singleRule -> name ) . "'" . ( $ showPattern ? " (" . htmlspecialchars ( $ singleRule -> pattern ) . ")" : '' ) . ' => ' . "'" . htmlspecialchars ( $ singleRule -> route ) . "'" . "\n" ; } break ; case RestUrlRule :: className ( ) : if ( is_array ( $ rule -> controller ) ) { //foreach ($rule->controller as $urlPrefix => $controller) break; $ urlPrefix = array_keys ( $ rule -> controller ) [ 0 ] ; $ controller = $ rule -> controller [ $ urlPrefix ] ; } else { $ controller = $ rule -> controller ; $ urlPrefix = '' ; } $ result .= "'{$rule->prefix}/{$urlPrefix}/...' ({$rule::className()}): <br>" ; foreach ( $ rule -> patterns as $ template => $ action ) { $ result .= static :: $ ruleShift . "'" . $ rule -> prefix . '/' . $ urlPrefix . '/' . htmlspecialchars ( $ template ) . htmlspecialchars ( $ rule -> suffix ) . "'" . " => '" . $ controller . '/' . htmlspecialchars ( $ action ) . "'" . "\n" ; } break ; default : $ result .= "{$rule::className()}:<br>" ; if ( method_exists ( $ rule , 'showRouteInfo' ) ) { $ info = $ rule -> showRouteInfo ( $ showPattern ) ; $ strings = explode ( "\n" , trim ( $ info ) ) ; foreach ( $ strings as $ str ) $ result .= static :: $ ruleShift . trim ( $ str ) . "\n" ; } else { ob_start ( ) ; ob_implicit_flush ( false ) ; var_dump ( $ rule ) ; $ result .= ob_get_clean ( ) ; } break ; } if ( $ echo ) { echo $ result ; } else { return $ result ; } }
docstring: Show route.
  @param yii\web\UrlRule $rule
  @param boolean $echo if true print resule otherwise return result in string
  @param boolean $showPattern
  @return string|null
docstring_tokens: Show route .