public static function showRoutes($moduleUid = '', $app = null, $echo = false)
    {
        if (empty($app)) {
            $app = Yii::$app;
        }
        $urlMan = $app->urlManager;
        $result = '';
        foreach ($urlMan->rules as $rule) {
            if (empty($moduleUid)) {
                $result .= static::showRoute($rule);
            } else {
                switch ($rule::className()) {
                    case GroupUrlRule::className():
                        foreach ($rule->rules as $singleRule) {
                            if (0 === strpos($singleRule->route, $moduleUid)) {
                                $result .= static::showRoute($rule); // will show all rules from group
                                break;
                            }
                        }
                        break;
                    case RestUrlRule::className():
                        if (is_array($rule->controller)) {
                            $urlPrefix = array_keys($rule->controller)[0];
                            $controller = $rule->controller[$urlPrefix];
                        } else {
                            $controller = $rule->controller;
                        }
                        if (0 === strpos($controller, $moduleUid)) {
                            $result .= static::showRoute($rule);
                        }
                        break;
                    default:
                        if (0 === strpos($rule->route, $moduleUid)) {
                            $result .= static::showRoute($rule);
                        }
                        break;
                }
           }
        }
        if ($echo) {
           echo $result;
        } else {
           return $result;
        }
    }
public static function showRoutes($moduleUid = '', $app = null, $echo = false)
    {
        if (empty($app)) {
            $app = Yii::$app;
        }
        $urlMan = $app->urlManager;
        $result = '';
        foreach ($urlMan->rules as $rule) {
            if (empty($moduleUid)) {
                $result .= static::showRoute($rule);
            } else {
                switch ($rule::className()) {
                    case GroupUrlRule::className():
                        foreach ($rule->rules as $singleRule) {
                            if (0 === strpos($singleRule->route, $moduleUid)) {
                                $result .= static::showRoute($rule); // will show all rules from group
                                break;
                            }
                        }
                        break;
                    case RestUrlRule::className():
                        if (is_array($rule->controller)) {
                            $urlPrefix = array_keys($rule->controller)[0];
                            $controller = $rule->controller[$urlPrefix];
                        } else {
                            $controller = $rule->controller;
                        }
                        if (0 === strpos($controller, $moduleUid)) {
                            $result .= static::showRoute($rule);
                        }
                        break;
                    default:
                        if (0 === strpos($rule->route, $moduleUid)) {
                            $result .= static::showRoute($rule);
                        }
                        break;
                }
           }
        }
        if ($echo) {
           echo $result;
        } else {
           return $result;
        }
    }
public static function showRoutes ( $ moduleUid = '' , $ app = null , $ echo = false ) { if ( empty ( $ app ) ) { $ app = Yii :: $ app ; } $ urlMan = $ app -> urlManager ; $ result = '' ; foreach ( $ urlMan -> rules as $ rule ) { if ( empty ( $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } else { switch ( $ rule :: className ( ) ) { case GroupUrlRule :: className ( ) : foreach ( $ rule -> rules as $ singleRule ) { if ( 0 === strpos ( $ singleRule -> route , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; // will show all rules from group break ; } } break ; case RestUrlRule :: className ( ) : if ( is_array ( $ rule -> controller ) ) { $ urlPrefix = array_keys ( $ rule -> controller ) [ 0 ] ; $ controller = $ rule -> controller [ $ urlPrefix ] ; } else { $ controller = $ rule -> controller ; } if ( 0 === strpos ( $ controller , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } break ; default : if ( 0 === strpos ( $ rule -> route , $ moduleUid ) ) { $ result .= static :: showRoute ( $ rule ) ; } break ; } } } if ( $ echo ) { echo $ result ; } else { return $ result ; } }
Show all application routes.
@param string $moduleUid module uniqueId
@param Application $app
@param boolean $echo if true print resule otherwise return result in string
@return string|null
Show all application routes .