converge (v): come together from different directions so as eventually to meet.

@param ConvergeCommand $command

@return \Baleen\Migrations\Common\Collection\CollectionInterface
500667
public function handle(ConvergeCommand $command)
    {
        $collection = $command->getCollection();
        $targetUp = $command->getTarget();
        $options = $command->getOptions();
        $domainBus = $command->getDomainBus();

        $position = $collection->getPosition($targetUp);
        $targetDown = $collection->getByPosition($position + 1);

        $changed = clone $collection;
        $changed->clear();

        $upCommand = new CollectionCommand(
            $collection,
            $targetUp,
            $options->withDirection(Direction::up()),
            $command->getVersionRepository()
        );
        $upChanges = $domainBus->handle($upCommand);
        if (!empty($upChanges)) {
            $changed->merge($upChanges);
        }

        // if we're not yet at the end of the queue (where no migrations can go down)
        if (null !== $targetDown) {
            $downCommand = new CollectionCommand(
                $collection,
                $targetDown,
                $options->withDirection(Direction::down()),
                $command->getVersionRepository()
            );
            $downChanges = $domainBus->handle($downCommand);
            if (!empty($downChanges)) {
                $changed->merge($downChanges);
            }
        }

        return $changed->sort();
    }
790919
protected function resolveCommand($command, array $parameters): CommandInterface
	{
		if($command instanceof CommandInterface)
		{
			return $command;
		}

		return $this->container->get($command, $parameters);
	}
913742
public function execute($command, callable $next)
    {
        if ($command->active) {
            if (!$command->storage) {
                throw new \RuntimeException("Require storage before using this middleware!");
            }

            $command->storage->setLineActiveCmd($command->getCmd());
            $command->storage->setLineCommandData($command->getData());
        }

        return $next($command);
    }
415692
public static function fromCommand(CommandInterface $command)
	{
		$file = new self();
		$file->setParameters($command->getResponse()->json() + array('path' => $command['path']));
		$file->finishUpload();
		return $file->getParameters();
	}
862620
public function resolveCommand($command)
    {
        if ($fullPaths = $this->findWhere($command)) {
            $fullPaths = preg_split('/[\r\n]/', trim($fullPaths));
            $command = end($fullPaths);
        }

        return $command;
    }
1330302
public function handle(AbstractCommand $command)
    {
        $this->commandDispatcher->handle($command);
        // Now that the command is handled, let's found if there is some events to publish
        $events = $this->extractEventsFromCommand($command);
        foreach ($events as $event) {
            // we will only publish event to synchronous listeners
            $this->publish($event);
        }

        return $command;
    }
530453
public function add(SymfonyCommand $command)
    	{
    		if ($command instanceof Command) {
    			$command->setThin($this->thin);
    		}

    		return $this->addToParent($command);
    	}
936920
public function add(Command $command)
    {
        $command->setApplication($this);

        if (!$command->isEnabled()) {
            $command->setApplication(null);

            return;
        }

        if (null === $command->getDefinition()) {
            throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
        }

        $this->commands[$command->getName()] = $command;

        foreach ($command->getAliases() as $alias) {
            $this->commands[$alias] = $command;
        }

        return $command;
    }
1038700
protected function registerTailCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Commands\TailCommand($app);
        });
    }
508665
protected function mapInputToCommand($command, $input)
    {
        if (is_object($command)) {
            return $command;
        }
        $dependencies = [];
        $class = new ReflectionClass($command);
        foreach ($class->getConstructor()->getParameters() as $parameter) {
            if ( $parameter->getPosition() == 0 && $parameter->isArray() ) {
                if ($input !== []) {
                    $dependencies[] = $input;
                } else {
                    $dependencies[] = $this->getDefaultValueOrFail($parameter);
                }
            } else {
                $name = $parameter->getName();
                if (array_key_exists($name, $input)) {
                    $dependencies[] = $input[$name];
                } else {
                    $dependencies[] = $this->getDefaultValueOrFail($parameter);
                }
            }
        }

        return $class->newInstanceArgs($dependencies);
    }
562498
public function resolve($command)
    {
        $commandInstance = $this->di->get($command);

        return $this->add($commandInstance);
    }
1041407
public function execute($command, callable $next)
    {
        $cmd = new SwitchedCommand();
        $cmd->message = new TextTemplate();
        $cmd->message->text = 'SwitchingMiddleware';
        $cmd->input = $command->input;

        $command['switchTo'] = $cmd;

        return $next($command);
    }
216393
public function commands(CommandCollector $command)
    {
        $commands = array(
            'modules' => CL::class . '::modulesCommand',
            'about' => CL::class . '::aboutCommand',
            'install' => CL::class . '::installCommand',
            'enable' => CL::class . '::enableCommand',
            'disable' => CL::class . '::disableCommand',
            'uninstall' => CL::class . '::uninstallCommand',
            'collect' => CL::class . '::collectCommand',
            'build-assets' => CL::class . '::buildAssetsCommand'
        );

        foreach ($commands as $name => $callback) {
            $command->register($name, $callback);
        }
    }
642898
public function addCommand(Command $command) {
        $this->commands[$command->getName()] = $command;
        $command->freeze();
        return $this;
    }
466289
public function exec($command)
    {
        $result = @ftp_exec($this->connection, $command);
        
        if ($result === false) {
            throw new Exception('Unable to exec command');
        }

        return $this;
    }
1314271
public static function parseCommand($command, $arguments) {
        if (is_array($arguments) == false) {
            return false;
        }

        array_unshift($arguments, $command);
        return self::_parseMultiBulk($arguments);
    }
1238818
public function getCommand($command): Command
    {
        if (isset($this->aliases[$command])) {
            return $this->aliases[$command];
        }

        if (isset($this->commands[$command])) {
            return $this->commands[$command];
        }

        throw new CommandNotFoundException($this, $command);
    }