Get the factory that matches the command object

@param CommandInterface $command Command retrieving the iterator for

@return ResourceIteratorFactoryInterface|bool
558176
protected function getFactory(CommandInterface $command)
    {
        foreach ($this->factories as $factory) {
            if ($factory->canBuild($command)) {
                return $factory;
            }
        }

        return false;
    }
1168667
public function getJob($command, array $args = [])
    {
        if (null !== $job = $this->findJob($command, $args)) {
            return $job;
        }

        throw new \RuntimeException(sprintf('Found no job for command "%s" with args "%s".', $command, json_encode($args)));
    }
1203151
public function getProvider($command)
    {
        $providerExists = (isset($this->providers[$command]) && class_exists($this->providers[$command]));
        return ($providerExists) ? new $this->providers[$command] : false;
    }
877806
public function request(CommandInterface $command)
    {
        if ($command instanceof UploadFile
            || $command instanceof UploadNewFileVersion) {
            return $command->execute($this->uploadClient);
        }

        return $command->execute($this->apiClient);
    }
298169
protected function getKeyFromZsetAggregationCommands(CommandInterface $command)
    {
        $arguments = $command->getArguments();
        $keys = array_merge(array($arguments[0]), array_slice($arguments, 2, $arguments[1]));

        if ($this->checkSameSlotForKeys($keys)) {
            return $arguments[0];
        }
    }
428517
protected function getCommand(InputInterface $input)
    {
        /** @var ServerRegistry $serverRegistry */
        $serverRegistry = $this->getContainer()->get('nanbando.server_registry');

        return $serverRegistry->getCommand($this->getServerName($input), $this->getName());
    }
971132
public function handle(CommandInterface $command)
    {
        $class = $command->getParameter('class');
        $object = $command->hasParameter('object') ? $command->getParameter('object') : null;

        // if no object has been given, try loading it using a query object
        if (!$object) {
            $object = $this->queryExecutor->execute($command->getParameter('query_object'));
        }

        // try removing the object if it is valid
        if ($object instanceof $class) {
            try {
                $this->objectManager->remove($object);
                $this->objectManager->flush();
            } catch (ForeignKeyConstraintViolationException $e) {
                return CommandResult::error('constraint_violation');
            }
        }
    }
251743
protected function getExecutableStoresForCommand(CommandInterface $command, ConfigurationInterface $configuration): array
    {
        if (!$command->hasStores()) {
            return $configuration->getExecutableStores();
        }

        return array_intersect($configuration->getExecutableStores(), $command->getStores());
    }
292959
public function dispatchToQueue($command)
    {
        $connection = $command->connection ?? null;

        $queue = call_user_func($this->queueResolver, $connection);

        if (! $queue instanceof Queue) {
            throw new RuntimeException('Queue resolver did not return a Queue implementation.');
        }

        if (method_exists($command, 'queue')) {
            return $command->queue($queue, $command);
        }

        return $this->pushCommandToQueue($queue, $command);
    }
323058
public function handle(CommandInterface $command)
    {
        $handleAll = $command->getParameter('selectedAll');
        $ids = $command->getParameter('selected');

        try {
            $this->queryExecutor->beginTransaction();

            if ($handleAll) {
                $criteria = \json_decode($command->getParameter('query'), true);
                $this->displayCriteriaFactory->setAttributes($criteria);
                $displayCriteria = $this->displayCriteriaFactory->createCriteria([
                    'filter' => $this->filterFactory->create($criteria['filter_type']),
                ]);
                $displayCriteria->getPager()->disable();

                $this->handleAll($displayCriteria);
            } else {
                foreach ($ids as $id) {
                    $result = $this->handleOne($id);

                    if (!$result->isSuccessful()) {
                        throw new \Exception();
                    }
                }
            }

            $this->queryExecutor->commit();
        } catch (\Exception $e) {
            $this->queryExecutor->rollback();

            $return = CommandResult::error('batch_error');
            if (isset($result)) {
                $return->addMessages($result->getMessages());
            }

            return $return;
        }

        return CommandResult::success('batch_success', ['%count%' => \count($ids)]);
    }
429688
public function getDispatcherFactory(ContainerInterface $container): DispatcherFactoryInterface
    {
        $autowired = $container->get('ellipse.dispatcher.autowiring.status');

        if ($autowired) {

            $interfaces = $container->get('ellipse.dispatcher.autowiring.interfaces');

            $container = new ReflectionContainer($container, $interfaces);

        }

        return new DefaultResolver($container);
    }
472889
protected function getConverter(InputInterface $input)
    {
        return $this->getConverterFactory()->get($input->getOption('input-format'), $this->output_format);
    }
1065258
protected function getCommand(string $name): CommandInterface
    {
        foreach ($this->commands as $command) {
            if ($command->getName() === $name) {
                return $command;
            }
        }

        throw new CommandNotFound($name);
    }
551327
public function run(CommandInterface $command)
    {
        $result = null;

        /** @var RunnerInterface $runner */
        foreach($this->runners as $runner) {
            $result = $runner->run($command, $result);
        }

        return $result;
    }
1187156
public function run(CommandInterface $command, $result = null)
    {
        return parent::run($command, $result)->wait();
    }
13561
public function request(CommandInterface $command)
    {
        if ($command instanceof MultipartDocumentUpload) {
            return $command->execute($this->uploadClient);
        }

        return $command->execute($this->apiClient);
    }
351736
protected function invokeHandler(CommandInterface $command, $first)
    {
        $aggregateRoot = null;
        try {
            $this->executing = true;

            $commandHandler = $this->locator->getCommandHandlerForCommand($command);

            $aggregateRoot = $commandHandler->handle($command);
        } catch (Exception $exception) {
            $this->executing = false;
            $this->handleException($exception, $first);
        }

        $this->executing = false;

        return $aggregateRoot;
    }