Returns a application allowing for known commands.
@todo  Account for commands to be loaded by the project namespace (ex: for cron commands).
@return Application The command line application
549083
public static function getApplication()
    {
        restore_error_handler();
        restore_exception_handler();

        $application = new Application('Strata Console Application', '0.1.0');

        $registrar = new ProjectCommandRegistrar($application);
        $registrar->assign();

        $registrar = new MiddlewareCommandRegistrar($application);
        $registrar->assign();

        $registrar = new StrataCommandRegistrar($application);
        $registrar->assign();

        return $application;
    }
692444
protected function startCommandsPlugin($app)
    {
        $this->onRegister('commands', function ($app) {
            /** @var \Illuminate\Foundation\Application $app */
            // Commands
            if ($app->runningInConsole()) {
                foreach ($this->findCommands as $path) {
                    $dir = path_get_directory((new ReflectionClass(get_called_class()))->getFileName());
                    $classes = $this->findCommandsIn(path_join($dir, $path), $this->findCommandsRecursive);

                    $this->commands = array_merge($this->commands, $classes);
                }
                if (is_array($this->commands) && count($this->commands) > 0) {
                    $commands = [];
                    foreach ($this->commands as $k => $v) {
                        if (is_string($k)) {
                            $app[ $this->commandPrefix.$k ] = $app->share(function ($app) use ($k, $v) {
                                return $app->build($v);
                            });

                            $commands[] = $this->commandPrefix.$k;
                        } else {
                            $commands[] = $v;
                        }
                    }
                    $this->commands($commands);
                }
            }
        });
    }
1193280
public static function allCustom()
    {
        // Response array
        $commands = [];

        // Loop through PHP files
        $dir = app_path('Console/Commands');
        if (!is_dir($dir)) return [];
        $files = scandir($dir);
        foreach ($files as $file) {
            if (!preg_match('#\w+\.php#', $file)) {
                continue;
            }

            // Build an instance of a command using the service container
            $path = $dir.'/'.$file;
            $class = 'App\Console\Commands\\'.basename($path, '.php');
            $command = app($class);

            // Validate command
            if (!is_a($command, 'Illuminate\Console\Command')) {
                continue;
            }

            // Get namespace
            $name = $command->getName();
            if (strpos($name, ':')) {
                list($namespace, $name) = explode(':', $name);
            } else {
                $namespace = 'misc';
            }

            // Massage name
            $name = str_replace('-', ' ', ucfirst($name));

            // Group commands by namespace
            $namespace = ucfirst($namespace);
            $name = ucfirst($name);
            if (!array_key_exists($namespace, $commands)) {
                $commands[$namespace] = [];
            }
            $commands[$namespace][$name] = $command;
        }

        // Return
        return $commands;
    }
1036796
protected function getConsole()
    {
        if (is_null($this->console)) {
            $console = new Console($this->app, $this->events, $this->app->version());
            $console->setName('Themosis Framework');

            return $this->console = $console->resolveCommands($this->commands);
        }

        return $this->console;
    }
730302
protected function getListCommands()
    {
        $commands = $this->application->all();
        $commandsArray = array();
        
        foreach ($commands as $command) {
            $commandsArray[] = array(
                'class'   => get_class($command),
                'name'    => $command->getName()
            );
        }
        
        return $commandsArray;
    }
1320048
protected function getCommandFactory()
    {
        if (!$this->commandFactory) {
            $this->commandFactory = CompositeFactory::getDefaultChain($this);
        }

        return $this->commandFactory;
    }
1023975
protected function getCommands()
    {
        $commands = [];

        foreach ($this->getApplication()->all() as $name => $command) {
            if (in_array($name, $this->commandWhitelist)) {
                $commands[] = $command;
            }
        }

        foreach (config('tinker.commands', []) as $command) {
            $commands[] = $this->getApplication()->resolve($command);
        }

        return $commands;
    }
118416
public function getApplication() {
		if (!is_null($this->session)) {
			return $this->session->getApplication();
		} else {
			return $this->context->getSystem()->getApplication();
		}
	}
1083382
public function consoleAction()
	{
	    $request   = $this->getRequest();
	    $service   = $this->fetchService();
	    $operation = $this->fetchOperation();
	    $query     = $this->fetchConsoleQuery();
	    
	    if (!$request instanceof ConsoleRequest) {
	        throw new \RuntimeException('You can only use this action from a console!');
	    }
	    
	    // Check flags
	    $verbose = $request->getParam('verbose') || $request->getParam('v');
	    $silent = $request->getParam('silent') || $request->getParam('s');
	    
	    $params = Json::decode(
            $query,
            Json::TYPE_ARRAY
        );
	    
	    try {
	        $data = $this->exec($service, $operation, $params, Command::CONTEXT_CLI);
	        return $this->prepareConsoleResponse($data, null, $verbose, $silent);
	    } catch (\Exception $exception) {
	        error_log($exception->getMessage() . ' (' . $exception->getFile().':'.$exception->getLine().')');
	        
	        return $this->prepareConsoleResponse(null, $exception, $verbose, $silent);
	    }
	}
433530
protected function getFreshApplication()
    {
        return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) {
            $app->make(ConsoleKernelContract::class)->bootstrap();
        });
    }
1364988
@Nonnull
    public String getCommandName() {
        String c = commandName;
        if (c != null)
            return c;
        return getArchitecture().getCommand();
    }
1195871
public java.util.List<ApplicationDescription> getApplications() {
        if (applications == null) {
            applications = new com.amazonaws.internal.SdkInternalList<ApplicationDescription>();
        }
        return applications;
    }
375469
public function getCommand(): Command
    {
        if ($this->command === null) {
            $this->command = new Command($this->controllerObjectName, $this->controllerCommandName);
        }
        return $this->command;
    }
541726
public function get()
    {
        foreach ($this->_commands as $command) {
            $location = $this->_commandLocator->locate(basename($command));
            if ($location !== null) {
                return $location;
            }
        }

        return null;
    }
1179073
public static ApplicationEnvironment get() {
        return INSTANCE.updateAndGet((env) -> {
            if (env != null) {
                return env;
            }

            try (AutoCloseable handle = Performance.time("Load application environment")) {
                return new ApplicationEnvironment();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
848147
public static function getInstance(): Application
    {
        if (self::$instance === null) {
            $calledClass = get_called_class(); //Autorize extends this class
            self::$instance = new $calledClass;
        }

        return self::$instance;
    }
59422
protected function createApplication()
    {
        putenv('APP_ENV=' . $this->getEnv());

        $app = require $this->appPath;

        $app->make(Kernel::class)->bootstrap();

        Carbon::setTestNow(Carbon::now());

        return $app;
    }