Button commands.

@return array
325746
public function commandBar(): array
    {
        return [

            Link::name(__('Settings'))
                ->icon('icon-open')
                ->group([
                    Link::name(__('Login as user'))
                        ->icon('icon-login')
                        ->method('switchUserStart'),

                    Link::name(__('Change Password'))
                        ->icon('icon-lock-open')
                        ->title(__('Change Password'))
                        ->method('changePassword')
                        ->modal('password'),
                ]),

            Link::name(__('Save'))
                ->icon('icon-check')
                ->method('save'),

            Link::name(__('Remove'))
                ->icon('icon-trash')
                ->method('remove'),
        ];
    }
904973
protected function getModulesCommands()
    {
        $commands = [];

        foreach (ModuleManager::getInstalledModules() as $module) {
            $cliFile = getLocalPath('modules/' . $module['ID'] . '/cli.php');

            if ($cliFile === false) {
                continue;
            } elseif (!Loader::includeModule($module['ID'])) {
                continue;
            }

            $config = include_once $this->getDocumentRoot() . $cliFile;

            if (isset($config['commands']) && is_array($config['commands'])) {
                $commands = array_merge($commands, $config['commands']);
            }
        }

        return $commands;
    }
823359
private function getAvailableCommands()
    {
        $commands = $this->getDefaultPiwikCommands();
        $detected = PluginManager::getInstance()->findMultipleComponents('Commands', 'Piwik\\Plugin\\ConsoleCommand');

        $commands = array_merge($commands, $detected);

        /**
         * Triggered to filter / restrict console commands. Plugins that want to restrict commands
         * should subscribe to this event and remove commands from the existing list.
         *
         * **Example**
         *
         *     public function filterConsoleCommands(&$commands)
         *     {
         *         $key = array_search('Piwik\Plugins\MyPlugin\Commands\MyCommand', $commands);
         *         if (false !== $key) {
         *             unset($commands[$key]);
         *         }
         *     }
         *
         * @param array &$commands An array containing a list of command class names.
         */
        Piwik::postEvent('Console.filterCommands', array(&$commands));

        $commands = array_values(array_unique($commands));

        return $commands;
    }
633229
public function getCommands()
    {
        $name     = $this->getController()->getIdentifier()->name;
        $package  = $this->getIdentifier()->package;
        $manifest = JPATH_ADMINISTRATOR.'/components/com_'.$package.'/'.$package.'.xml';

        if(file_exists($manifest))
        {
            $xml = simplexml_load_file($manifest);

            if(isset($xml->administration->submenu))
            {
                foreach($xml->administration->submenu->children() as $menu)
                {
                    $view = (string)$menu['view'];

                    $this->addCommand((string)$menu, array(
                        'href'   => 'option=com_'.$package.'&view='.$view,
                        'active' => ($name == KStringInflector::singularize($view))
                    ));
                }
            }
        }

        return parent::getCommands();
    }
688448
protected function createPageButtons()
        {
                if(($pageCount=$this->getPageCount())<=1)
                        return array();

                list($beginPage,$endPage)=$this->getPageRange();
                $currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
                $buttons=array();

                // first page
                $buttons[]=$this->createPageButton($this->firstPageLabel,0,self::CSS_FIRST_PAGE,$currentPage<=0,false);

                // prev page
                if(($page=$currentPage-1)<0)
                        $page=0;
                $buttons[]=$this->createPageButton($this->prevPageLabel,$page,self::CSS_PREVIOUS_PAGE,$currentPage<=0,false);

                // internal pages
                for($i=$beginPage;$i<=$endPage;++$i)
                        $buttons[]=$this->createPageButton($i+1,$i,self::CSS_INTERNAL_PAGE,false,$i==$currentPage);

                // next page
                if(($page=$currentPage+1)>=$pageCount-1)
                        $page=$pageCount-1;
                $buttons[]=$this->createPageButton($this->nextPageLabel,$page,self::CSS_NEXT_PAGE,$currentPage>=$pageCount-1,false);

                // last page
                $buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1,self::CSS_LAST_PAGE,$currentPage>=$pageCount-1,false);

                return $buttons;
        }
1218150
public function getArgumentDefinitions(): array
    {
        if (!$this->hasArguments()) {
            return [];
        }
        $commandArgumentDefinitions = [];
        $commandMethodReflection = $this->getCommandMethodReflection();
        $annotations = $commandMethodReflection->getTagsValues();
        $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command');
        $i = 0;
        foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) {
            $explodedAnnotation = explode(' ', $annotations['param'][$i]);
            array_shift($explodedAnnotation);
            array_shift($explodedAnnotation);
            $description = implode(' ', $explodedAnnotation);
            $required = $commandParameterDefinition['optional'] !== true;
            $commandArgumentDefinitions[] = new CommandArgumentDefinition($commandParameterName, $required, $description);
            $i ++;
        }
        return $commandArgumentDefinitions;
    }
976125
public function commandBar(): array
    {
        return [
            Link::name(__('Save'))
                ->icon('icon-check')
                ->method('save'),

            Link::name(__('Remove'))
                ->icon('icon-trash')
                ->method('remove'),
        ];
    }
731262
protected function commands()
    {
        $commands = $this->app['config']->get('mount.commands', []);
        if ($commands) {
            Artisan::starting(function ($artisan) use ($commands) {
                $artisan->resolveCommands($commands);
            });
        }
    }
638862
protected function getCommands()
    {
        return \array_merge($this->commands, [
            \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
            \Laravel\Lumen\Console\Commands\ServeCommand::class,
        ]);
    }
525016
public function getCommandCallbacks($command = null)
    {
        $result = array();
        if($command)
        {
            if(isset($this->__command_callbacks[$command])) {
                $result = $this->__command_callbacks[$command];
            }
        }
        else $result = $this->__command_callbacks;

        return $result;
    }
617707
public function shortcuts(): ?array
  {
    if (
      ($id_option = $this->from_path('shortcuts')) &&
      ($menu = $this->pref->get_by_option($id_option))
    ){
      $links = $this->pref->get_bits($menu['id']);
      $res = [];
      foreach ( $links as $link ){
        if ( ($url = $this->to_path($link['id_option'])) ){
          $res[] = [
            'id' => $link['id'],
            'id_option' => $link['id_option'],
            'url' => $url,
            'text' => $link['text'],
            'icon' => $link['icon'],
            'num' => $link['num']
          ];
        }
      }
      return $res;
    }
    return null;
  }
507802
protected function getCommandDescriptions()
    {
        $descriptions = [];
        foreach ($this->getCommands() as $command) {
            $description = '';

            $result = $this->app->createController($command);
            if ($result !== false && $result[0] instanceof Controller) {
                [$controller, $actionID] = $result;
                /** @var Controller $controller */
                $description = $controller->getHelpSummary();
            }

            $descriptions[$command] = $description;
        }

        return $descriptions;
    }
605842
protected function getDefaultCommands()
    {
        $sudo = new Command\SudoCommand();
        $sudo->setReadline($this->readline);

        $hist = new Command\HistoryCommand();
        $hist->setReadline($this->readline);

        return [
            new Command\HelpCommand(),
            new Command\ListCommand(),
            new Command\DumpCommand(),
            new Command\DocCommand(),
            new Command\ShowCommand($this->config->colorMode()),
            new Command\WtfCommand($this->config->colorMode()),
            new Command\WhereamiCommand($this->config->colorMode()),
            new Command\ThrowUpCommand(),
            new Command\TimeitCommand(),
            new Command\TraceCommand(),
            new Command\BufferCommand(),
            new Command\ClearCommand(),
            new Command\EditCommand($this->config->getRuntimeDir()),
            // new Command\PsyVersionCommand(),
            $sudo,
            $hist,
            new Command\ExitCommand(),
        ];
    }
148775
protected function getCommands()
    {
        $commands = [];

        $routes = $this->map->getRoutes();
        ksort($routes);

        $text = '';
        foreach ($routes as $route) {
            $name    = $route->name;
            $summary = $this->getCommandSummary($route);
            $text .= "    {$name}" . PHP_EOL;
            $text .= "        {$summary}" . PHP_EOL;
        }

        return "<<bold>>COMMANDS<<reset>>" . PHP_EOL
             . "    " . trim($text) . PHP_EOL . PHP_EOL;
    }
387142
public function getCommandName()
    {
        preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches);
        return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method';
    }
445722
protected function createPageButtons()
	{
		if (($pageCount = $this->getPageCount()) <= 1)
			return array();

		list ($beginPage, $endPage) = $this->getPageRange();

		$currentPage = $this->getCurrentPage(false); // currentPage is calculated in getPageRange()

		$buttons = array();

		// first page
		if ($this->displayFirstAndLast)
			$buttons[] = $this->createPageButton($this->firstPageLabel, 0, 'first', $currentPage <= 0, false);

		// prev page
		if (($page = $currentPage - 1) < 0)
			$page = 0;

		$buttons[] = $this->createPageButton($this->prevPageLabel, $page, 'previous', $currentPage <= 0, false);

		// internal pages
		for ($i = $beginPage; $i <= $endPage; ++$i)
			$buttons[] = $this->createPageButton($i + 1, $i, '', false, $i == $currentPage);

		// next page
		if (($page = $currentPage+1) >= $pageCount-1)
			$page = $pageCount-1;

		$buttons[] = $this->createPageButton($this->nextPageLabel, $page, 'next', $currentPage >= ($pageCount - 1), false);

		// last page
		if ($this->displayFirstAndLast)
			$buttons[] = $this->createPageButton($this->lastPageLabel, $pageCount - 1, 'last', $currentPage >= ($pageCount - 1), false);

		return $buttons;
	}
346346
protected function getDefaultCommands()
    {
        $commands = parent::getDefaultCommands();
        $commands[] = new Command\MetricsCommand();
        $commands[] = new Command\AddCommand();
        $commands[] = new Command\SortCommand();
        $commands[] = new Command\GuessCommand();

        return $commands;
    }