Override main() to handle action
Displays all routes in an application.

@return void
488440
public function main()
    {
        $output = [
            ['Route name', 'URI template', 'Defaults']
        ];
        foreach (Router::routes() as $route) {
            $name = isset($route->options['_name']) ? $route->options['_name'] : $route->getName();
            ksort($route->defaults);
            $output[] = [$name, $route->template, json_encode($route->defaults)];
        }
        $this->helper('table')->output($output);
        $this->out();
    }
499547
public function handle()
    {
        $this->table = new Table($this->output);

        if (count($this->routes) == 0) {
            return $this->error("Your application doesn't have any routes.");
        }

        $this->displayRoutes($this->getRoutes());
    }
741767
public function main()
    {
        // Check if all required data is present.
        $this->checkRequirements();

        if ($this->_drushDir == '/sites/all/drush') {
            $drushDir = $this->_siteRoot.$this->_drushDir;
        } else {
            $drushDir = $this->_drushDir;
        }

        $aliasesFile = $drushDir.'/aliases.drushrc.php';

        $aliases = array(
            'default' => array(
                'uri'  => $this->_siteUrl,
                'root' => $this->_siteRoot,
            ),
            'docker' => array(
                'uri'  => $this->_siteUrl,
                'root' => $this->_siteRoot,
            ),
        );

        if (empty($this->_aliasName)) {
            $sites = new Finder();
            $sites
                ->directories()
                ->depth('== 0')
                ->exclude('all')
                ->in($this->_siteRoot.'/sites');

            foreach ($sites as $site) {
                $aliases[$site->getBasename()] = array(
                   'uri'  => $this->_siteUrl,
                   'root' => $aliases['default']['root'],
                );
            }
        } else {
            $aliases += $this->loadAliases($aliasesFile);
            $aliases[$this->_aliasName] = array(
                'uri'  => $this->_siteUrl,
                'root' => $aliases['default']['root'],
            );
        }//end if

        $aliasesArray = "<?php \n\n\$aliases = ".var_export($aliases, true).";";

        if (file_put_contents($aliasesFile, $aliasesArray)) {
            $this->log(
                "Succesfully wrote aliases to file '".$aliasesFile."'",
                Project::MSG_INFO
            );
        } else {
            $this->log(
                "Was unable to write aliases to file '".$aliasesFile."'",
                Project::MSG_WARN
            );
        }
    }
133349
public function run()
    {
        echo $this->renderLogo();
        echo $this->renderMenuToggler();
        echo $this->renderNavigationMenu();

        echo Html::endTag('div');   //page-header-inner
        echo Html::endTag('div');   // page-header
    }
1252573
public function main()
    {
        // CakeAdmin Migration
        $this->out('Migrating CakeAdmin Tables...');
        $this->migrate('CakeAdmin');
        $this->out('<info>Migrating CakeAdmin Tables completed!</info>');
        $this->hr();

        // Notifier Migration
        $this->out('Migrating Notifier Tables...');
        $this->migrate('Notifier');
        $this->out('<info>Migrating Notifier Tables completed!</info>');
        $this->hr();

        // Settings Migration
        $this->out('Migrating Settings Tables...');
        $this->migrate('Settings');
        $this->out('<info>Migrating Settings Tables completed!</info>');
        $this->hr();

        $createAdmin = $this->in('Do you want to create your first administrator?', ['Y', 'n'], 'Y');

        if ($createAdmin === 'Y') {
            $this->out('Generating a new administrator...');
            $this->dispatchShell('admin');
        }
    }
1241002
public function main()
    {
        if (count($this->args) < 2) {
            return $this->error('Please pass the controller and action name.');
        }
        $controllerName = Inflector::camelize($this->args[0]);
        $actionName = Inflector::camelize($this->args[1]);
        $this->plugin = isset($this->params['plugin']) ? $this->params['plugin'] : null;

        $this->BakeTemplate->set('controllerName', $controllerName);
        $this->BakeTemplate->set('actionName', $actionName);
        $content = $this->BakeTemplate->generate('FrontendBridge.webroot/js_controller');

        $this->bake($controllerName, $actionName, $content);
    }
423810
public function fire()
	{
		$this->table = $this->getHelperSet()->get('table');

		if (count($this->routes) == 0)
		{
			return $this->error("Your application doesn't have any routes.");
		}

		$this->displayRoutes($this->getRoutes());
	}
843386
public function viewAction()
    {
        $model = $this->loadModel();
        if (!$model->getId()) {
            $this->_forward('noroute');
            return;
        }

        $this->loadLayout();
        $this->renderLayout();
    }
662800
public function viewAction()
    {
        $stack = $this->_initStackInstance();
        if (!$stack) {
            $this->_redirect('*/*/');
            return;
        }
        $this->_initAction();
        $this->renderLayout();
    }
139389
public function main_init() {
		if ( $this->_initialized ) {
			return;
		}
		$this->_initialized = true;

		$this->filter->do_action( 'app_initialize', $this );
		$this->setup_property();
		$this->setup_textdomain();
		$this->setup_settings();
		$this->filter->do_action( 'app_initialized', $this );
	}
1344440
public function main()
    {
        if (!defined('QUICKAPPS_CORE')) {
            return parent::main();
        }

        if (empty($this->params['xml'])) {
            $this->out(__d('cms', '<info>Current Paths:</info>'), 2);
            $this->out(__d('cms', '* QuickApps Core: {0}', [normalizePath(QUICKAPPS_CORE)]));
            $this->out(__d('cms', '* CakePHP Core:   {0}', [normalizePath(CORE_PATH)]));
            $this->out(__d('cms', '* Site Path:      {0}', [normalizePath(ROOT)]));
            $this->out('');

            $this->out(__d('cms', '<info>Available Shells:</info>'), 2);
        }

        $shellList = $this->Command->getShellList();
        if (empty($shellList)) {
            return;
        }

        if (empty($this->params['xml'])) {
            $this->_asText($shellList);
        } else {
            $this->_asXml($shellList);
        }
    }
580756
public function main()
    {
        // check to make sure task received all correct params
        $this->validate();

        $generatorConfig = $this->getGeneratorConfig();
        $totalNbFiles = 0;

        $dataModels = $this->getDataModels();
        $this->log('Generating PHP files...');

        foreach ($dataModels as $dataModel) {
            $this->log("Datamodel: " . $dataModel->getName(), Project::MSG_VERBOSE);

            foreach ($dataModel->getDatabases() as $database) {

                if ($this->getGeneratorConfig()->getBuildProperty('disableIdentifierQuoting')) {
                    $database->getPlatform()->setIdentifierQuoting(false);
                }

                $this->log(" - Database: " . $database->getName(), Project::MSG_VERBOSE);

                foreach ($database->getTables() as $table) {

                    if (!$table->isForReferenceOnly()) {

                        $nbWrittenFiles = 0;

                        $this->log("  + Table: " . $table->getName(), Project::MSG_VERBOSE);

                        // -----------------------------------------------------------------------------------------
                        // Create Peer, Object, and TableMap classes
                        // -----------------------------------------------------------------------------------------

                        // these files are always created / overwrite any existing files
                        foreach (array('peer', 'object', 'tablemap', 'query') as $target) {
                            $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                            $nbWrittenFiles += $this->build($builder);
                        }

                        // -----------------------------------------------------------------------------------------
                        // Create [empty] stub Peer and Object classes if they don't exist
                        // -----------------------------------------------------------------------------------------

                        // these classes are only generated if they don't already exist
                        foreach (array('peerstub', 'objectstub', 'querystub') as $target) {
                            $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                            $nbWrittenFiles += $this->build($builder, $overwrite = false);
                        }

                        // -----------------------------------------------------------------------------------------
                        // Create [empty] stub child Object classes if they don't exist
                        // -----------------------------------------------------------------------------------------

                        // If table has enumerated children (uses inheritance) then create the empty child stub classes if they don't already exist.
                        if ($col = $table->getChildrenColumn()) {
                            if ($col->isEnumeratedClasses()) {
                                foreach ($col->getChildren() as $child) {
                                    foreach (array('queryinheritance') as $target) {
                                        if (!$child->getAncestor()) {
                                            continue;
                                        }
                                        $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                                        $builder->setChild($child);
                                        $nbWrittenFiles += $this->build($builder, $overwrite = true);
                                    }
                                    foreach (array('objectmultiextend', 'queryinheritancestub') as $target) {
                                        $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                                        $builder->setChild($child);
                                        $nbWrittenFiles += $this->build($builder, $overwrite = false);
                                    }
                                } // foreach
                            } // if col->is enumerated
                        } // if tbl->getChildrenCol


                        // -----------------------------------------------------------------------------------------
                        // Create [empty] Interface if it doesn't exist
                        // -----------------------------------------------------------------------------------------

                        // Create [empty] interface if it does not already exist
                        if ($table->getInterface()) {
                            $builder = $generatorConfig->getConfiguredBuilder($table, 'interface');
                            $nbWrittenFiles += $this->build($builder, $overwrite = false);
                        }

                        // -----------------------------------------------------------------------------------------
                        // Create tree Node classes
                        // -----------------------------------------------------------------------------------------

                        if ($table->treeMode()) {
                            switch ($table->treeMode()) {
                                case 'NestedSet':
                                    foreach (array('nestedsetpeer', 'nestedset') as $target) {
                                        $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                                        $nbWrittenFiles += $this->build($builder);
                                    }
                                    break;

                                case 'MaterializedPath':
                                    foreach (array('nodepeer', 'node') as $target) {
                                        $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                                        $nbWrittenFiles += $this->build($builder);
                                    }

                                    foreach (array('nodepeerstub', 'nodestub') as $target) {
                                        $builder = $generatorConfig->getConfiguredBuilder($table, $target);
                                        $nbWrittenFiles += $this->build($builder, $overwrite = false);
                                    }
                                    break;

                                case 'AdjacencyList':
                                    // No implementation for this yet.
                                default:
                                    break;
                            }
                        } // if Table->treeMode()

                        // ----------------------------------
                        // Create classes added by behaviors
                        // ----------------------------------
                        if ($table->hasAdditionalBuilders()) {
                            foreach ($table->getAdditionalBuilders() as $builderClass) {
                                $builder = new $builderClass($table);
                                $builder->setGeneratorConfig($generatorConfig);
                                $nbWrittenFiles += $this->build($builder, isset($builder->overwrite) ? $builder->overwrite : true);
                            }
                        }

                        $totalNbFiles += $nbWrittenFiles;
                        if ($nbWrittenFiles == 0) {
                            $this->log("\t\t(no change)", Project::MSG_VERBOSE);
                        }
                    } // if !$table->isForReferenceOnly()

                } // foreach table

            } // foreach database

        } // foreach dataModel
        if ($totalNbFiles) {
            $this->log(sprintf("Object model generation complete - %d files written", $totalNbFiles));
        } else {
            $this->log("Object model generation complete - All files already up to date");
        }
    }
880245
protected function loadRoutes() : void
    {
        $routeConfig = Core::i()->config->getConfiguration('routes');
        // If there is a default route, make it last in the array
        if (isset($routeConfig['default'])) {
            $default_route = $routeConfig['default'];
            unset($routeConfig['default']);
            $routeConfig['default'] = $default_route;
        }
        // Parse the routes and build the regex strings
        foreach ($routeConfig as $route_name => $route) {
            $regex = $route['route'];
            $regex = str_replace('/', '\/', $regex);
            $regex = str_replace('[', '(', $regex);
            $regex = str_replace(']', ')?', $regex);
            if (isset($route['constraints'])) {
                foreach ($route['constraints'] as $key => $constraint) {
                    $regex = str_replace(':' . $key . ':', "(?P<{$key}>" . $constraint . ')', $regex);
                }
            }
            $routeConfig[$route_name]['regex'] = '/^' . $regex . '$/i';
        }
        $this->route_definitions = $routeConfig;
    }
191037
public function run()
    {
        $data       = $this->parseRequestUri();
        $controller = $data['controller'];
        $method     = $data['method'];
        $params     = $data['params'];

        $subModule  = $this->subModule;
        if ("" != $subModule) {
            $subModule = "\\" . $subModule;
        }

        $class      = sprintf("%s\\Controller%s\\%sController", $this->appNameSpace, $subModule, $controller);
        if (!(class_exists($class) && method_exists($class, $method))) {
            $this->fileNotFound();
        } else {
            $class  = new $class;
            $pipe = new Pipeline();
            $pipe->through($class->getMiddleWare())->then(function () use ($class, $method, $params) {
                call_user_func_array(array($class, $method), $params);
            });

            //call_user_func_array(array($class, $method), $params);
        }
    }
163564
public function main()
    {
        switch ($this->getAction()) {
            case "start":
                $this->start();
                break;
            case "stop":
                $this->stop();
                break;
            case "lap":
                $this->lap();
                break;
            default:
                throw new BuildException('action should be one of start, stop, lap.');
        }
    }
889412
async function main() {
  event.$emit('before-client-render')

  if (globalState.initialData) {
    dataStore.replaceState(globalState.initialData)
  }

  await routerReady(router)

  if (router.getMatchedComponents().length === 0) {
    throw new ReamError(pageNotFound(router.currentRoute.path))
  }
}
107319
public function handle()
    {
        if (0 == count($this->routes)) {
            $this->error('Your application does not have any routes.');

            return;
        }

        $this->displayRoutes($this->getRoutes());
    }