Analyzes and modifies command.

@param ConsoleCommandEvent $event Command event
769269
public function command(ConsoleCommandEvent $event)
    {
        /** @var BridgeCommand $command */
        $command = $event->getCommand();

        if (!in_array($command->getName(), $this->getSupportedCommands())) {
            return;
        }

        $command->setRegistry($this->registry);
    }
830481
protected function fireEvent($event)
    {
        $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
    }
278346
protected static function createCommand($event)
    {
        $extra = $event->getComposer()->getPackage()->getExtra();
        $command = 'ckeditor:install';

        if (isset($extra['ckeditor-path'])) {
            $command .= ' '.$extra['ckeditor-path'];
        }

        if (isset($extra['ckeditor-release'])) {
            $command .= ' --release='.$extra['ckeditor-release'];
        }

        if (isset($extra['ckeditor-tag'])) {
            $command .= ' --tag='.$extra['ckeditor-tag'];
        }

        if (isset($extra['ckeditor-clear'])) {
            $command .= ' --clear='.$extra['ckeditor-clear'];
        }

        if (isset($extra['ckeditor-exclude'])) {
            foreach ($extra['ckeditor-exclude'] as $exclude) {
                $command .= ' --exclude='.$exclude;
            }
        }

        return $command;
    }
246637
protected function listCommands(CommandEvent $event, EventQueueInterface $queue)
    {
        $targets = $event->getTargets();
        $target = reset($targets);
        $nick = $event->getNick();

        if ($target === $event->getConnection()->getNickname()) {
            $target = $nick;
            $address = '';
        } else {
            $address = $nick . ': ';
        }

        $method = 'irc' . $event->getCommand();
        $message = $address . $this->listText . implode(' ', $this->commands);
        $queue->$method($target, $message);
    }
639308
public function onCommandAfterPrepare(Event $event) {

        $command = $event['command'];
        $bucket = $command['Bucket'];
        $request = $command->getRequest();
        if ($command->getName() == 'ListBuckets')
        {
            if ($this->ipport != null) {
                $request->setHost($this->ipport);
                $request->setHeader('Host', 'service.cos.myqcloud.com');
            } else if ($this->endpoint != null) {
                $request->setHost($this->endpoint);
                $request->setHeader('Host', 'service.cos.myqcloud.com');
            }
            else {

                $request->setHost('service.cos.myqcloud.com');
            }
            return ;
        }
        if ($key = $command['Key']) {
            // Modify the command Key to account for the {/Key*} explosion into an array
            if (is_array($key)) {
                $command['Key'] = $key = implode('/', $key);
            }
        }
        $request->setHeader('Date', gmdate('D, d M Y H:i:s T'));
        $request->setPath(preg_replace("#^/{$bucket}#", '', $request->getPath()));

        if ($this->appId != null && endWith($bucket,'-'.$this->appId) == False)
        {
            $bucket = $bucket.'-'.$this->appId;
        }
//        $request->setPath(urldecode($request->getPath()));
        $request->getParams()->set('bucket', $bucket)->set('key', $key);

        $realHost = $bucket. '.' . $request->getHost();
        if($this->ipport != null) {
            $request->setHost($this->ipport);
            $request->setHeader('Host', $realHost);
        } else {
            if($this->endpoint != null) {
                $tmp = $bucket. '.' . $this->endpoint;
                $request->setHost($tmp);
            } else {
                $request->setHost($realHost);
            }
        }
        if (!$bucket) {
            $request->getParams()->set('cos.resource', '/');
        } else {
            // Bucket style needs a trailing slash
            $request->getParams()->set(
                'cos.resource',
                '/' . rawurlencode($bucket) . ($key ? ('/' . Client::encodeKey($key)) : '/')
            );
        }
    }
1214871
public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
1295064
public function command($command)
    {
        if (! $command instanceof Command) {
            $command = $this[$command];
        }

        $this['console']->add($command);
    }
470246
protected function fireBeforeCommandEvent($command)
	{
		$eventName = $this->commandNameToEventName($command);

		$args = [$command];

		$this->fireEvent($eventName, 'before', $args);
	}
1288317
public function listen(Event $event)
    {
        if (!empty($this->handledEvents[$event->getName()])) {
            return;
        }
        $this->handledEvents[$event->getName()] = true;
        // Plugin has been uninstalled
        if (!file_exists(__FILE__) || !file_exists(__DIR__ . '/PluginImplementation.php')) {
            return;
        }

        // Load the implementation only after updating Composer so that we get
        // the new version of the plugin when a new one was installed
        if (null === $this->pluginImplementation) {
            $this->pluginImplementation = new PluginImplementation($event);
        }

        switch ($event->getName()) {
            case ScriptEvents::PRE_AUTOLOAD_DUMP:
                $this->pluginImplementation->preAutoloadDump();
                break;
            case ScriptEvents::POST_AUTOLOAD_DUMP:
                $this->pluginImplementation->postAutoloadDump();
                break;
        }
    }
273352
public function run(ScriptEvent $event): bool
    {
        if (!$this->shouldRun($event)) {
            return true;
        }
        $io = $event->getIO();
        $io->writeError('');
        $io->writeError('<info>Setting up TYPO3</info>');

        $consoleIO = new ConsoleIo($event->getIO());
        $this->ensureTypo3Booted();
        $commandDispatcher = CommandDispatcher::createFromComposerRun($event);
        $setup = new CliSetupRequestHandler(
            new ConsoleOutput($consoleIO->getOutput(), $consoleIO->getInput()),
            $commandDispatcher
        );
        $setup->setup($consoleIO->isInteractive(), $this->populateCommandArgumentsFromEnvironment());
        putenv('TYPO3_IS_SET_UP=1');

        $installedFileContent = '';
        if ($this->isDotEnvEnabled) {
            $installedFileContent .= 'TYPO3_CONTEXT=Development' . chr(10);
        }
        file_put_contents($this->installedFile, $installedFileContent);

        return true;
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
357749
public function beforePrepare(Event $event)
	{
		$command = $event['command'];

		if ($command->getName() !== 'createEntity') return;
		if (!$command['_id']) return;

		$operation = $command->getOperation();
		$operation->setHttpMethod('PUT');
	}
1040633
protected function registerMakeEventCommand($command)
     {
         $this->app->singleton($command, function ($app) {
             return new Generators\Commands\EventMakeCommand($app);
         });
     }
438884
public function beforePrepare(Event $event)
	{
		$command = $event['command'];
		$operation = $command->getOperation();
		$client = $command->getClient();

		if ($command->getName() !== 'updateEntity') return;
		if ($operation->getParam('collection')->getDefault() !== 'user') return;

		// Attempt to get the model's deleted at value from the array of values passed
		// to the command.
		$statusValue = false;

		if ($command->offsetExists(Model::DELETED_AT))
		{
			$statusValue = $command->offsetGet(Model::DELETED_AT);
		}
		elseif ($command->offsetExists('_kmd'))
		{
			$_kmd = array_dot($command->offsetGet('_kmd'));

			$statusField = MODEL::DELETED_AT;
			$statusField = str_replace('_kmd.', '', MODEL::DELETED_AT);

			if (array_key_exists($statusField, $_kmd))
			{
				$statusValue = $_kmd[$statusField];
			}
		}

		// Could not determine the status field.
		if ($statusValue === false)
		{
			return;
		}
		// Suspend the user.
		elseif (!is_null($statusValue))
		{
			$event->stopPropagation();

			$suspendCommand = $client->getCommand('deleteEntity', array(
				'collection' => 'user',
				'_id' => $command->offsetGet('_id'),
			));
			$suspendCommand->execute();
		}
		// Restore.
		else
		{
			$event->stopPropagation();

			$restoreCommand = $client->getCommand('restore', array(
				'_id' => $command->offsetGet('_id'),
			));
			$restoreCommand->execute();
		}
	}
244317
public function onCommand($event)
    {
        $this->data['commands'][] = array(
            'command' => $event->getCommand(),
            'arguments' => $event->getArguments(),
            'executiontime' => $event->getExecutionTime(),
        );
    }
483884
public function onWSClientCommand(WSEventDispatcher\WSClientEvent $event)
    {
        //$command = $event->getCommand();
        //$arguments = $event->getArguments();
        $this->data['commands'][] = array(
            'command'   => $event->getCommand(),
            'arguments' => $event->getArguments(),
            'url' => $event->getUrl(),
            'cache' => $event->getUseCache(),
            'content' => $event->getContent(),
            'key' => $event->getKey(),
            'statusCode' => $event->getStatusCode(),
            'executiontime' => $event->getTiming()
        );
    }
229710
protected function runSingleServerEvent($event)
    {
        if ($this->schedule->serverShouldRun($event, $this->startedAt)) {
            $this->runEvent($event);
        } else {
            $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay());
        }
    }