@param ApplicationPassword $application

@return Command<ApplicationPassword>
975559
public function createApplicationPassword(ApplicationPassword $application)
    {
        return $this->createCommand()
            ->setRequest($this->client->post('application'))
            ->setBodyEntity($application, 'json')
            ->setResponseClass('Maba\OAuthCommerceInternalClient\Entity\ApplicationPassword')
        ;
    }
949657
public function setDirectories(BBApplication $application = null)
    {
        if (null !== $application) {
            $this->_application = $application;

            $this->setTemporaryDir($application->getTemporaryDir())
                    ->setStorageDir($application->getStorageDir())
                    ->setMediaDir($application->getMediaDir());
        }

        return $this;
    }
931309
public function getApplication(): Application
    {
        if (!empty($this->application)) {
            return $this->application;
        }

        $this->application = new Application($this->config->getName(), $this->config->getVersion());
        $this->application->setCatchExceptions(false);
        $this->application->setAutoExit(false);

        if (!is_null($this->locator)) {
            foreach ($this->locator->locateCommands() as $command) {
                $this->application->add($command);
            }
        }

        // Register user defined commands
        $static = new StaticLocator($this->config->getCommands(), $this->container);
        foreach ($static->locateCommands() as $command) {
            $this->application->add($command);
        }

        return $this->application;
    }
416486
protected function requireAuthorization(Application $app)
    {
        /** @var ResourceServer $server */
        $server = $app[ResourceServer::class];
        try {
            $server->isValidRequest(false);
        } catch(OAuthException $e) {
            return new JsonResponse(
                [
                    'error' => $e->errorType,
                    'message' => $e->getMessage(),
                ],
                $e->httpStatusCode,
                $e->getHttpHeaders()
            );
        }
        return null;
    }
938512
public static function setApplicationPHPCRSession(Application $application, string $sessionName = null, bool $admin = false)
    {
        $registry = $application->getKernel()->getContainer()->get('doctrine_phpcr');
        $session = $admin ? $registry->getAdminConnection($sessionName) : $registry->getConnection($sessionName);

        $helperSet = $application->getHelperSet();
        if (class_exists(Version::class)) {
            $helperSet->set(new DocumentManagerHelper($session));
        } else {
            $helperSet->set(new PhpcrHelper($session));
        }

        if ($session instanceof JackalopeSession
            && ($session->getTransport() instanceof DbalClient
                || $session->getTransport() instanceof DbalLoggingClient
            )
        ) {
            $helperSet->set(new DoctrineDBALHelper($session->getTransport()->getConnection()));
        }
    }
1105719
public function setApplication($app)
    {
        Argument::i()->test(1, 'string');

        $this->application = $app;
        return $this->setData($this->message);
    }
232722
public function registerCommands(Application $application)
    {
        foreach ($this->getCommands() as $command) {
            $application->add($command);
        }
    }
100425
public static function getKey(): string
    {
        $key = static::getConfig('application')->get('key');

        if ($key === null || $key === '') {
            throw new ApplicationException('The key \'key\' in application config is invalid; please set non-empty string there');
        }

        if ($key == '_____ENTERSomeRandomKeyHere_____') {
            throw new ApplicationException('Please configure key \'key\' in main application config, it can\'t be _____ENTERSomeRandomKeyHere_____');
        }

        if (strlen($key) > 32) {
            throw new ApplicationException('Please make sure your application key in application config is not longer then 32 chars');
        }

        return $key;
    }
358130
public function removeCredentialsByApplicationId($applicationId)
    {
        return $this->createCommand()
            ->setRequest(
                $this->client->delete(Url::factory('application')->setQuery(array('applicationId' => $applicationId)))
            )
        ;
    }
839861
private function getPassword(InputInterface $input, OutputInterface $output)
    {
        if ($pass = $input->getOption('pass')) {
            return $pass;
        }
        if ($pass = $this->getTransifexConfigValue('/pass')) {
            $this->writelnVerbose($output, 'Using transifex password specified in config.');

            return $pass;
        }
        if ($pass = getenv('transifexpass')) {
            $this->writelnVerbose($output, 'Using transifex password specified in environment.');

            return $pass;
        }
        if ($input->isInteractive()) {
            /** @var \Symfony\Component\Console\Helper\QuestionHelper $dialog */
            $dialog = $this->getHelperSet()->get('question');
            if ($pass = $dialog->ask($input, $output, (new Question('Transifex password:'))->setHidden(true))) {
                return $pass;
            }
        }

        throw new \RuntimeException('Error: you must either specify a password on the commandline or run interactive.');
    }
294236
protected function assertRequiredKeysExist(Application $app)
    {
        $required = [
            'path.base',
        ];

        $missingKeys = array_diff($required, $app->keys());
        if (false === empty($missingKeys)) {
            $message = 'Missing required config parameters ('.implode(', ', $missingKeys).')';
            throw new \RuntimeException($message);
        }
    }
524393
protected function buildCommands(
        Deployment $deployment,
        Application $application,
        $options = []
    ) {
        $commands = [];
        $command = '';
        $commandProvider = $this->commandProviderService->getDetectedCommandProvider($deployment, $application);
        switch ($commandProvider) {
            case CommandProviderService::COMMAND_PROVIDER_COREAPI:
                $command = $this->buildCoreapiCommand($deployment, $application, $options);
                break;
            case CommandProviderService::COMMAND_PROVIDER_TYPO3_CONSOLE:
                $command = $this->buildTypo3ConsoleCommand($options);
                break;
            default:
                // Do nothing
        }

        if ($command === '') {
            throw new CommandProviderException('The used Provider (' . $commandProvider . ') has no implementation for this task.', 1494672441);
        }

        $commands[] = 'cd ' . escapeshellarg($deployment->getApplicationReleasePath($application));
        if (!empty($options['context'])) {
            $commands[] = 'export TYPO3_CONTEXT=' . escapeshellarg($options['context']);
        }
        $commands[] = $command;

        return $commands;
    }
480688
public function validateApplication($application)
    {
        if (!is_string($application)
            || strlen($application) > 256
            || strlen($application) < 1
        ) {
            throw new InvalidArgumentException(
                'Application name must be a non empty string of at most 256 ' .
                'characters',
                400
            );
        }

        return $this;
    }
724246
public function connect(Application $app)
    {
        $ctrl = $app['controllers_factory'];



        /**
         * Homepage
         */
        $ctrl
            ->get(
                '/',
                function () use ($app) {
                    $root = str_replace('index.php/', '', $app['url_generator']->generate('home'));

                    if ($app['request']->getRequestURI() != $root) {
                        return $app->redirect($root, Response::HTTP_MOVED_PERMANENTLY);
                    }

                    return $app['twig']->render('front/partials/home.twig');
                }
            )
            ->bind('home');



        /**
         * Admin root
         */
        $ctrl
            ->get(
                '/admin',
                function () use ($app) {
                    return $app->redirect($app['url_generator']->generate($app['config']['admin']['root']));
                }
            );


        /**
         * robots.txt
         */
        $ctrl
            ->get(
                '/robots.txt',
                function () use ($app) {
                    $response = new Response(
                        'User-agent: *'.PHP_EOL.(
                            $app['debug']
                                ? 'Disallow: /'
                                : 'Sitemap: '.$app['url_generator']->generate('home').'sitemap.xml'
                        )
                    );

                    $response->headers->set('Content-Type', 'text/plain');
                    return $response;
                }
            );



        return $ctrl;
    }
1147396
public function setApplication(\CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Application $application = null)
    {
        $this->application = $application;

        return $this;
    }
658428
protected function setFirewallsAndAccessRules(Application $app)
    {
        $app->extend('security.firewalls', function ($firewalls, $app) {
            $createUser = new RequestMatcher('^/users$', null, ['POST']);
            $verifyRegistration = new RequestMatcher('^/users/[0-9]+/verify-registration$', null, ['POST']);

            $userFirewalls = [
                'create-users' => [
                    'pattern'   => $createUser, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'verify-registration' => [
                    'pattern'   => $verifyRegistration, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'reset-password' => [
                    'pattern'   => '^/user/reset-password$',
                    'anonymous' => true,
                ],
            ];

            return array_merge($userFirewalls, $firewalls);
        });

        $app->extend('security.access_rules', function ($rules, $app) {
            $usersAdminFunctionRequestMatcher = new RequestMatcher('^/users/\d+$', null, ['GET']);
            $newRules = [
                [$usersAdminFunctionRequestMatcher, 'ROLE_ADMIN']
            ];
            return array_merge($newRules, $rules);
        });
    }
812976
public function execute(string $uri = null): ApplicationInterface
    {
        $this->callExecute($uri) || parent::execute($uri);

        return $this;
    }