Gets an array of the recorded commands in reverse.

@throws \Phinx\Migration\IrreversibleMigrationException if a command cannot be reversed.
@return \Phinx\Db\Plan\Intent
555771
public function getInvertedCommands()
    {
        $inverted = new Intent();

        foreach (array_reverse($this->commands) as $com) {
            switch (true) {
                case $com instanceof CreateTable:
                    $inverted->addAction(new DropTable($com->getTable()));
                    break;

                case $com instanceof RenameTable:
                    $inverted->addAction(new RenameTable(new Table($com->getNewName()), $com->getTable()->getName()));
                    break;

                case $com instanceof AddColumn:
                    $inverted->addAction(new RemoveColumn($com->getTable(), $com->getColumn()));
                    break;

                case $com instanceof RenameColumn:
                    $column = clone $com->getColumn();
                    $name = $column->getName();
                    $column->setName($com->getNewName());
                    $inverted->addAction(new RenameColumn($com->getTable(), $column, $name));
                    break;

                case $com instanceof AddIndex:
                    $inverted->addAction(new DropIndex($com->getTable(), $com->getIndex()));
                    break;

                case $com instanceof AddForeignKey:
                    $inverted->addAction(new DropForeignKey($com->getTable(), $com->getForeignKey()));
                    break;

                default:
                    throw new IrreversibleMigrationException(sprintf(
                        'Cannot reverse a "%s" command',
                        get_class($com)
                    ));
            }
        }

        return $inverted;
    }
1023975
protected function getCommands()
    {
        $commands = [];

        foreach ($this->getApplication()->all() as $name => $command) {
            if (in_array($name, $this->commandWhitelist)) {
                $commands[] = $command;
            }
        }

        foreach (config('tinker.commands', []) as $command) {
            $commands[] = $this->getApplication()->resolve($command);
        }

        return $commands;
    }
527281
public function reverse() : self
    {
        $list = $this->list;
        $count = $this->list->getSize();
        $newList = new \SplFixedArray($count);

        foreach ($newList as $index => $val) {
            $newList[$index] = $list[$count - $index - 1];
        }

        return new static($newList);
    }
1237321
public function getRan()
    {
        $migrations = $this->query()
                            ->getQuery()
                            ->getResult();

        $return = [];
        foreach ($migrations as $migration) {
            $return[] = $migration['migration'];
        }

        return $return;
    }
1218179
protected function getActionsFileManager()
    {
        $commands = $this->command->getHandlers();

        foreach ($commands as $command_id => $command) {
            if (empty($command['multiple'])) {
                unset($commands[$command_id]);
            }
        }

        return $commands;
    }
222966
protected function getDefaultCommands()
	{
		$commands = parent::getDefaultCommands();
		$commands[] = new ShowCommand($this->getComposerAccessor());
		$commands[] = new SelfUpdateCommand($this->getVictorUpdater());

		$this->setDefaultCommand(ShowCommand::NAME);

		return $commands;
	}
1080339
public function getReverseDiff()
    {
        $diff = new self();

        // tables
        $diff->setFromTable($this->toTable);
        $diff->setToTable($this->fromTable);

        // columns
        if ($this->hasAddedColumns()) {
            $diff->setRemovedColumns($this->addedColumns);
        }

        if ($this->hasRemovedColumns()) {
            $diff->setAddedColumns($this->removedColumns);
        }

        if ($this->hasRenamedColumns()) {
            $renamedColumns = [];
            foreach ($this->renamedColumns as $columnRenaming) {
                $renamedColumns[] = array_reverse($columnRenaming);
            }
            $diff->setRenamedColumns($renamedColumns);
        }

        if ($this->hasModifiedColumns()) {
            $columnDiffs = [];
            foreach ($this->modifiedColumns as $name => $columnDiff) {
                $columnDiffs[$name] = $columnDiff->getReverseDiff();
            }
            $diff->setModifiedColumns($columnDiffs);
        }

        // pks
        if ($this->hasRemovedPkColumns()) {
            $diff->setAddedPkColumns($this->removedPkColumns);
        }

        if ($this->hasAddedPkColumns()) {
            $diff->setRemovedPkColumns($this->addedPkColumns);
        }

        if ($this->hasRenamedPkColumns()) {
            $renamedPkColumns = [];
            foreach ($this->renamedPkColumns as $columnRenaming) {
                $renamedPkColumns[] = array_reverse($columnRenaming);
            }
            $diff->setRenamedPkColumns($renamedPkColumns);
        }

        // indices
        if ($this->hasRemovedIndices()) {
            $diff->setAddedIndices($this->removedIndices);
        }

        if ($this->hasAddedIndices()) {
            $diff->setRemovedIndices($this->addedIndices);
        }

        if ($this->hasModifiedIndices()) {
            $indexDiffs = [];
            foreach ($this->modifiedIndices as $name => $indexDiff) {
                $indexDiffs[$name] = array_reverse($indexDiff);
            }
            $diff->setModifiedIndices($indexDiffs);
        }

        // fks
        if ($this->hasAddedFks()) {
            $diff->setRemovedFks($this->addedFks);
        }

        if ($this->hasRemovedFks()) {
            $diff->setAddedFks($this->removedFks);
        }

        if ($this->hasModifiedFks()) {
            $fkDiffs = [];
            foreach ($this->modifiedFks as $name => $fkDiff) {
                $fkDiffs[$name] = array_reverse($fkDiff);
            }
            $diff->setModifiedFks($fkDiffs);
        }

        return $diff;
    }
539608
public function getReverseDiff()
    {
        $diff = new self();

        // tables
        $diff->setFromTable($this->getToTable());
        $diff->setToTable($this->getFromTable());

        // columns
        $diff->setAddedColumns($this->getRemovedColumns());
        $diff->setRemovedColumns($this->getAddedColumns());
        $renamedColumns = array();
        foreach ($this->getRenamedColumns() as $columnRenaming) {
            $renamedColumns[] = array_reverse($columnRenaming);
        }
        $diff->setRenamedColumns($renamedColumns);
        $columnDiffs = array();
        foreach ($this->getModifiedColumns() as $name => $columnDiff) {
            $columnDiffs[$name] = $columnDiff->getReverseDiff();
        }
        $diff->setModifiedColumns($columnDiffs);

        // pks
        $diff->setAddedPkColumns($this->getRemovedPkColumns());
        $diff->setRemovedPkColumns($this->getAddedPkColumns());
        $renamedPkColumns = array();
        foreach ($this->getRenamedPkColumns() as $columnRenaming) {
            $renamedPkColumns[] = array_reverse($columnRenaming);
        }
        $diff->setRenamedPkColumns($renamedPkColumns);

        // indices
        $diff->setAddedIndices($this->getRemovedIndices());
        $diff->setRemovedIndices($this->getAddedIndices());
        $indexDiffs = array();
        foreach ($this->getModifiedIndices() as $name => $indexDiff) {
            $indexDiffs[$name] = array_reverse($indexDiff);
        }
        $diff->setModifiedIndices($indexDiffs);

        // fks
        $diff->setAddedFks($this->getRemovedFks());
        $diff->setRemovedFks($this->getAddedFks());
        $fkDiffs = array();
        foreach ($this->getModifiedFks() as $name => $fkDiff) {
            $fkDiffs[$name] = array_reverse($fkDiff);
        }
        $diff->setModifiedFks($fkDiffs);

        return $diff;
    }
989014
public function reverse()
	{
		$oldString		= $this->string;
		$this->string	= strrev( $this->string );
		return $this->string !== $oldString;
	}
600328
protected function getCommandDescriptions()
    {
        $commands = [];
        foreach ($this->getCommands() as $command) {
            $actions = [];
            $result = Yii::$app->createController($command);
            if ($result !== false && $result[0] instanceof \Hprose\Yii\Controller) {
                list($controller) = $result;
                /** @var Controller $controller */
                $actions = $this->getActions($controller);
            }

            $commands[$command] = $actions;
        }

        return $commands;
    }
364897
protected function getCommandNames()
    {
        // Command::Hidden isn't supported before Symfony Console 3.2.0
        // We don't complete hidden command names as these are intended to be private
        if (method_exists('\Symfony\Component\Console\Command\Command', 'isHidden')) {
            $commands = array();

            foreach ($this->application->all() as $name => $command) {
                if (!$command->isHidden()) {
                    $commands[] = $name;
                }
            }

            return $commands;

        } else {

            // Fallback for compatibility with Symfony Console < 3.2.0
            // This was the behaviour prior to pull #75
            $commands = $this->application->all();
            unset($commands['_completion']);

            return array_keys($commands);
        }
    }
96773
public function getCommands()
    {
        return array(
            new All(),
            new CBF(),
            new CC(),
            new CPD(),
            new CS(),
            new CSF(),
            new LOC(),
            new MD(),
            new PM(),
            new SEC(),
        );
    }
1027757
public function getCommandsInOrder(): array
    {
        $commands = array_filter($this->commands);

        $order = [];

        $counter = 0;

        while (!empty($commands)) {
            ++$counter;

            if ($counter === 50) {
                throw new ImpossibleWriteOrderException(array_keys($commands));
            }

            foreach ($commands as $definition => $defCommands) {
                $dependencies = $this->hasDependencies($this->definitions[$definition], $commands);

                if (!empty($dependencies)) {
                    continue;
                }

                foreach ($defCommands as $command) {
                    $order[] = $command;
                }

                unset($commands[$definition]);
            }
        }

        return $order;
    }
1102675
public function locatorAction()
    {
        $arg = $this->request->get('args');

        // task execute.
        if (($task = $this->request->get('tasks')) || ($task = $this->request->get('option.T'))) {
            return [self::FORWARD_ACTION, 'task.list'];
        } elseif ($this->isTask($arg)) {
            return [self::FORWARD_ACTION, 'task.execute'];
        }
        
        // start server.
        if ($arg === 's') {
            return [self::FORWARD_ACTION, 'utility.server'];
        }
        
        // show version.
        if ($arg === null && ($this->request->get('option.v') || $this->request->get('version'))) {
            return [self::FORWARD_ACTION, 'utility.version'];
        }
        
        // show usage.
        if ($arg === null) {
            return [self::FORWARD_ACTION, 'utility.usage'];
        }

        // action execute.
        // exclude first argument, because this is command name.
        $args = $this->request->getAsArray('args');
        array_shift($args);
        $this->request->set('args', $args);
        return [self::FORWARD_ACTION, $this->completionActionArg($arg)];
    }
529722
public function getAllCommandPrototype()
    {
        $lines = [];

        if (method_exists($this, 'execute')) {
            $lines[] = $this->getCommandPrototype();
        }

        if ($this->hasCommands()) {
            foreach ($this->commands as $name => $subcmd) {
                $lines[] = $subcmd->getCommandPrototype();
            }
        }

        return $lines;
    }
980710
public function getReverseDiff()
    {
        $diff = new self();

        // columns
        $diff->setFromColumn($this->toColumn);
        $diff->setToColumn($this->fromColumn);

        // properties
        $changedProperties = [];
        foreach ($this->changedProperties as $name => $propertyChange) {
            $changedProperties[$name] = array_reverse($propertyChange);
        }
        $diff->setChangedProperties($changedProperties);

        return $diff;
    }
138215
public function getRevManifest(): array {
        if (is_null(self::$_revManifest)) {
            $manifestPath = APPLICATION_PATH . '/../rev-manifest-' . APPLICATION_ENV . '.json';
            self::$_revManifest = file_exists($manifestPath)
                ? json_decode(file_get_contents($manifestPath), true)
                : [];
        }
        return self::$_revManifest;
    }