@param AbstractCommand $command

@return AbstractEvent[]
423844
private function extractEventsFromCommand(AbstractCommand $command)
    {
        $events = [];
        foreach ($command->aggregateRoots as $aggregateRoot) {
            $events = array_merge($events, $aggregateRoot->pullEvents());
        }

        return $events;
    }
373986
protected static function getOptions(CommandEvent $event)
    {
        $options = array_merge(
            array(
                'teleport-tpl-dir' => 'tpl',
                'teleport-tpl-update' => true
            ),
            $event->getComposer()->getPackage()->getExtra()
        );
        return $options;
    }
123824
public function dispatch(CommandInterface $command)
    {
        $aggregateRoots = $this->commandBus->dispatch($command);

        $this->dispatchEvents($aggregateRoots);

        return $aggregateRoots;
    }
486693
protected function filter(UpdateMetricCommand $command)
    {
        $params = [
            'name'          => $command->name,
            'suffix'        => $command->suffix,
            'description'   => $command->description,
            'default_value' => $command->default_value,
            'calc_type'     => $command->calc_type,
            'display_chart' => $command->display_chart,
            'places'        => $command->places,
            'default_view'  => $command->default_view,
            'threshold'     => $command->threshold,
            'order'         => $command->order,
            'visible'       => $command->visible,
        ];

        return array_filter($params, function ($val) {
            return $val !== null;
        });
    }
722532
protected function _getArgumentNames($controller, $command)
    {
        $controllerClassName = $this->_getControllerClassName($controller);
        if (!class_exists($controllerClassName)) {
            return [];
        }

        $command = Text::camelize($command) . 'Command';
        if (!method_exists($controllerClassName, $command)) {
            return [];
        }

        $arguments = [];
        foreach ((new \ReflectionMethod($controllerClassName, $command))->getParameters() as $parameter) {
            $arguments[] = '--' . strtr($parameter->name, '_', '-');
        }

        return $arguments;
    }
1140497
public static @NonNull ClickEvent runCommand(final @NonNull String command) {
    return new ClickEvent(Action.RUN_COMMAND, command);
  }
1164630
public function executeProcess($command)
    {
        $process = new Process($command);
        $process->setTimeout(null);
        $output = $this->output;
        $callback = function ($type, $data) use ($output) {
            $output->writeln(trim($data));
        };
        $exitCode = $process->run($callback);
        return [$exitCode, trim($process->getOutput())];
    }
886131
protected function getKeyFromScriptingCommands(CommandInterface $command)
    {
        if ($command instanceof ScriptCommand) {
            $keys = $command->getKeys();
        } else {
            $keys = array_slice($args = $command->getArguments(), 2, $args[1]);
        }

        if ($keys && $this->checkSameSlotForKeys($keys)) {
            return $keys[0];
        }
    }
1264962
public function dispatch(CommandInterface $command)
    {
        $this->commandStack[] = $command;

        if ($this->executing) {
            return array();
        }

        $first          = true;
        $aggregateRoots = array();

        while ($command = array_shift($this->commandStack)) {
            $aggregateRoots[] = $this->invokeHandler($command, $first);
            $first            = false;
        }

        return $aggregateRoots;
    }
260875
private static function runCommand($command)
    {
        if (!function_exists('proc_open')) {
            return null;
        }

        $descriptorSpec = [
            1 => ['pipe', 'w'],
            2 => ['pipe', 'w'],
        ];
        $process = proc_open($command, $descriptorSpec, $pipes, null, null, ['suppress_errors' => true]);
        if (!is_resource($process)) {
            return null;
        }

        $info = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        fclose($pipes[2]);
        proc_close($process);

        return $info;
    }
696630
public function addCommand($command)
    {
        if (is_array($command)) {
            foreach ($command as $cmd) {
                $this->addCommand($cmd);
            }
        }

        if (is_string($command)) {
            $command = new Command($command);
            $this->commandsList[] = $command;
        }

        return $this;
    }
233120
protected function getKeyFromScriptingCommands(string $command, array $arguments)
    {
        $keys = \array_slice($arguments, 2, $arguments[1]);

        if ($keys && $this->checkSameSlotForKeys($keys)) {
            return $keys[0];
        }

        return null;
    }
285405
public function execute($command, $cwd = null)
    {
        if (strpos($command, '<') === 0) {
            return array(true, trim($command, '< '));
        }
        
        $processExecutor = $this->getProcessExecutor();

        $logger = $this->logger;

        $output = '';
        
        $outputHandler = function ($type, $data) use ($logger, &$output) {
            $output .= $data;
            
            $logger->writeVerbose('comment', trim($data));
        };
        
        if ($this->logger->getOutputInstance()->isVerbose()) {
            $this->logger->writeIndentation();
        }
        
        $result = $processExecutor->execute($command, $outputHandler, $cwd);

        return array($result === 0, $output);
    }
362454
public function exec($command)
    {
        $this->_events[] = $event = new Event($this->_mutex, $command);
        return $event;
    }
275124
protected function filter(UpdateIncidentCommand $command)
    {
        $params = [
            'name'             => $command->name,
            'status'           => $command->status,
            'message'          => $command->message,
            'visible'          => $command->visible,
            'stickied'         => $command->stickied,
            'component_id'     => $command->component_id,
            'component_status' => $command->component_status,
            'notify'           => $command->notify,
        ];

        return array_filter($params, function ($val) {
            return $val !== null;
        });
    }
13970
public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );

		return [ $output, $return_var ];
	}
1209845
public function addCommand(Command $command)
    {
        if (is_string($command)) {
            $command = new $command;
        }
        $map = (new CommandMapping($this->parser))->map($command);

        CommandBag::add($map->name, [
            'object' => $command,
            'map' => $map
        ]);

        return $this;
    }