Do Transition from C

@return self Fluent Interface
1783
private function doTransitionFromC() : self
    {
        if ($this->getToken() === Grammar::T_X) {
            if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_X) {
                if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_X) {
                    $this
                        ->setState(self::STATE_B)
                        ->addPosition(3)
                        ->addTokenValue(Grammar::T_X, null, 3);
                    return $this;
                }

                $this
                    ->setState(self::STATE_B)
                    ->addPosition(2)
                    ->addTokenValue(Grammar::T_X, null, 2);
                return $this;
            }

            $this
                ->setState(self::STATE_B)
                ->addPosition(1)
                ->addTokenValue(Grammar::T_X);
            return $this;
        }

        $this->setState(self::STATE_B);
        return $this;
    }
389316
public function exec() : self
    {
        $descSpec = [
            0 => ["pipe", "r"]
        ];
        foreach ($this->listener as $chanId => $listener) {
            $descSpec[$chanId] = ["pipe", "w"];
        }

        $this->proc = proc_open($this->cmd, $descSpec, $pipes);

        if ($this->proc === false)
            throw new \Exception("Unable to proc_open()");

        //print_r (proc_get_status($this->proc));

        foreach ($this->listener as $chanId => $listener) {
            stream_set_blocking($pipes[$chanId], 0);
        }
        $this->pipes = $pipes;
        return $this;
    }
827152
public function begin() {
        if ($this->transactionLevel < 0) throw new RuntimeException('Negative transaction nesting level detected: '.$this->transactionLevel);

        if (!$this->transactionLevel)
            $this->execute('start transaction');

        $this->transactionLevel++;
        return $this;
    }
25391
private static Transition makeTransitionToSelf(Pattern regex) {
    return new Transition(regex) {
      @Override
      Context computeNextContext(Context prior, Matcher matcher) {
        return prior;
      }
    };
  }
542360
def set_transition(self, p_self):
        '''
        '''
        if p_self is None:
            self.transition = None
        else:
            self.transition = np.empty((len(self._classes), 2, 2))
            if np.isscalar(p_self):
                self.transition = transition_loop(2, p_self)
            elif len(p_self) != len(self._classes):
                raise ParameterError('Invalid p_self.shape={} for vocabulary size={}'.format(p_self.shape, len(self._classes)))
            else:
                for i in range(len(self._classes)):
                    self.transition[i] = transition_loop(2, p_self[i])
650487
protected function invokeLogging() {
        $this->config['log'] = [
            'colorize' => true,
            'verbosity' => Log::ALL | ~Log::DEBUG
        ];

        $this->log = new Log();

        return $this;
    }
39366
public function addTransition(callable $transitionBuilderCallable)
    {
        $transitionBuilder = new TransitionBuilder();
        call_user_func($transitionBuilderCallable, $transitionBuilder);
        $transition = $transitionBuilder->getTransition();

        $this->transitions[$transition->getInitialStateName()][$transition->getName()] = $transition;
        return $this;
    }
123674
public function moveToTop()
    {
        if ($this->isNotInList()) return $this;

        $this->getConnection()->transaction(function() {

            $this->incrementPositionsOfItemsAbove();

            $this->setListPosition($this->listifyTop());
        });

        return $this;
    }
410664
public function & InitAll () {
		/** @var $this \MvcCore\Route */
		if ($this->match === NULL && $this->reverse === NULL) {
			$this->initMatchAndReverse();
		} else if ($this->match !== NULL && ($this->reverseParams === NULL || $this->lastPatternParam === NULL)) {
			$this->initReverse();
		}
		return $this;
	}
1001017
public function withAutoGeneratedName(): self
    {
        if ($this->isPassive()) {
            throw new PassiveQueueDeclarationMustHaveAName;
        }

        $self = clone $this;
        $self->name = null;

        return $self;
    }
1051609
public function addTransition(TransitionInterface $transition): self
    {
        if (!$this->states->hasKey($transition->getFrom())) {
            throw new UnknownState('Trying to add transition from unknown state: ' . $transition->getFrom());
        }
        if (!$this->states->hasKey($transition->getTo())) {
            throw new UnknownState('Trying to add transition to unknown state: ' . $transition->getTo());
        }
        $transition_key = $transition->getFrom().$transition->getTo();
        if ($this->transitions->hasKey($transition_key)) {
            throw new InvalidStructure(
                sprintf('Trying to add same transition twice: %s -> %s', $transition->getFrom(), $transition->getTo())
            );
        }
        $builder = clone $this;
        $builder->transitions[$transition_key] = $transition;
        return $builder;
    }
150344
public function unshift(/* variadic arguments allowed */): self
    {
        $this->generatorToArray();

        if (\func_num_args()) {
            $args = \func_get_args();
            \array_unshift(...[&$this->array], ...$args);
        }

        return $this;
    }
1348350
protected function defaults(): self
    {
        $this->option('-h, --help', 'Show help')->on([$this, 'showHelp']);
        $this->option('-V, --version', 'Show version')->on([$this, 'showVersion']);
        $this->option('-v, --verbosity', 'Verbosity level', null, 0)->on(function () {
            $this->set('verbosity', ($this->verbosity ?? 0) + 1);

            return false;
        });

        // @codeCoverageIgnoreStart
        $this->onExit(function ($exitCode = 0) {
            exit($exitCode);
        });
        // @codeCoverageIgnoreEnd

        return $this;
    }
409239
public function envRestart()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->engineInstance()->restart();
        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }
1266845
public function createTransition(string $from, string $to, array $config = null): TransitionInterface
    {
        $transition = Maybe::unit($config);
        if (is_string($transition->when->get())) {
            $config['when'] = [ $transition->when->get() ];
        }
        $implementor = $transition->class->get() ?? $this->class_map->get('transition');
        if (!in_array(TransitionInterface::CLASS, class_implements($implementor))) {
            throw new MissingImplementation(
                'Trying to create transition without implementing required '.TransitionInterface::CLASS
            );
        }
        $constraints = [];
        foreach (Maybe::unit($config)->when->get() ?? [] as $expression) {
            if (!is_string($expression)) {
                continue;
            }
            $constraints[] = new ExpressionConstraint($expression, $this->expression_engine);
        }
        $settings = new Settings(Maybe::unit($config)->settings->get() ?? []);
        return new $implementor($from, $to, $settings, $constraints);
    }
1368125
protected function initInstances(): self
    {
        if (is_array($this->data) && !empty($this->data)) {
            //Iterates and instantiate records
            $iterator = new RecordIterator($this->data, $this->class, $this->orm);

            foreach ($iterator as $item) {
                if (in_array($item, $this->instances, true)) {
                    //Skip duplicates
                    continue;
                }

                $this->instances[] = $item;
            }
        }

        //Memory free
        $this->data = null;

        return $this;
    }
1013198
private function doTransitionFromD() : self
    {
        if ($this->getToken() === Grammar::T_L) {
            $this
                ->setState(self::STATE_C)
                ->addPosition(1)
                ->addTokenValue(Grammar::T_L);
            return $this;
        }

        if ($this->getToken() === Grammar::T_X && $this->hasToken(1) && $this->getToken(1) === Grammar::T_L) {
            $this
                ->setState(self::STATE_B)
                ->addPosition(2)
                ->addTokenValue(Grammar::T_L, Grammar::T_X);
            return $this;
        }

        if ($this->getToken() === Grammar::T_X && $this->hasToken(1) && $this->getToken(1) === Grammar::T_C) {
            $this
                ->setState(self::STATE_B)
                ->addPosition(2)
                ->addTokenValue(Grammar::T_C, Grammar::T_X);
            return $this;
        }

        $this->setState(self::STATE_C);
        return $this;
    }