Unfold trace.

@return bool
323456
private function unfold(): bool
    {
        while (0 < \count($this->todo)) {
            $rule = \array_pop($this->todo);

            if ($rule instanceof Escape) {
                $this->addTrace($rule);
            } else {
                $out = $this->reduce($this->grammar->fetch($rule->getRule()), $rule->getData());

                if ($out === false && $this->backtrack() === false) {
                    return false;
                }
            }
        }

        return true;
    }
1261215
public function readUnlimited()
    {
        if (!isset($this->bev)) {
            return false;
        }
        $read = $this->bev->read($this->bev->input->length);
        if ($read === null) {
            return false;
        }
        return $read;
    }
1371472
public function isRewindable()
    {
        if (null !== $this->rewindable) {
            return $this->rewindable;
        }

        // workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed
        if ('' === $this->getPath()) {
            return $this->rewindable = false;
        }

        if (false !== $stream = @opendir($this->getPath())) {
            $infos = stream_get_meta_data($stream);
            closedir($stream);

            if ($infos['seekable']) {
                return $this->rewindable = true;
            }
        }

        return $this->rewindable = false;
    }
24431
public function startTrans()
    {
        $this->initConnect(true);
        if (!$this->linkID) {
            return false;
        }

        ++$this->transTimes;
        try {
            if (1 == $this->transTimes) {
                $this->linkID->beginTransaction();
            } elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
                $this->linkID->exec(
                    $this->parseSavepoint('trans' . $this->transTimes)
                );
            }

        } catch (\PDOException $e) {
            if ($this->isBreak($e)) {
                return $this->close()->startTrans();
            }
            throw $e;
        } catch (\Exception $e) {
            if ($this->isBreak($e)) {
                return $this->close()->startTrans();
            }
            throw $e;
        }
        return null;
    }
1287586
private function peek()
	{
		return ($this->inPos < $this->inLength) ? $this->in[$this->inPos] : self::EOF;
	}
665206
protected function getCallerFromStackTrace()
    {
        $trace = collect(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))->forget(0);

        return $trace->first(function ($frame) {
            if (! isset($frame['file'])) {
                return false;
            }

            return ! Str::contains($frame['file'],
                base_path('vendor'.DIRECTORY_SEPARATOR.$this->ignoredVendorPath())
            );
        });
    }
115495
public function check()
    {
        $this->state = self::STATE_UNCHECKED;
        
        // check all conditions
        /* @var $processor \Sokil\FraudDetector\ProcessorInterface */
        foreach($this->processorDeclarationList->getKeys() as $processorName) {
            $processor = $this->getProcessor($processorName);

            if($processor->isPassed()) {
                $processor->afterCheckPassed();
                $this->trigger(self::STATE_PASSED . ':' . $processorName);
                
                // check passed if all processors passes their cheks
                if ($this->state === self::STATE_UNCHECKED) {
                    $this->state = self::STATE_PASSED;
                }
            } else {
                $processor->afterCheckFailed();
                $this->trigger(self::STATE_FAILED . ':' . $processorName);
                // if any processor failed - all check failed
                $this->state = self::STATE_FAILED;
            }
        }

        $this->trigger($this->state);
    }
60630
public function rewind()
    {
        $trail = array();
        $this->setTrail($trail);
        $classes = &$this->getClasses();

        $traversed = array();
        $this->setTraversed($traversed);

        $root = $this->getRootComponent();
        $this->pushOnTrail($root, $root->getComponents());

        $hasTrail = false;
        $foundClass = false;
        while (count($this->getTrail()) > 0) {
            $hasTrail = true;
            $trailEntry = $this->popFromTrail();

            $this->setValid(true);
            $this->currentComponent = $trailEntry[1];
            $this->currentContainer = $trailEntry[0];
            $this->markTraversed($this->currentComponent);
            $this->pushOnTrail($this->currentComponent, $this->currentComponent->getComponents());

            if (empty($classes) === true || in_array($this->currentComponent->getQtiClassName(), $classes) === true) {
                $foundClass = true;
                break;
            }
        }

        if (count($this->trail) === 0 && (($hasTrail && !$foundClass) || (!$hasTrail))) {
            $this->isValid = false;
            $this->currentComponent = null;
            $this->currentContainer = null;
        }
    }
367148
protected function openTrace()
    {
        $index = \count($this->traces);

        $this->traces[$index] = [];
        $this->trace =& $this->traces[$index];

        $this->indents[$index] = [];
        $this->indent =& $this->indents[$index];

        if ($this->performStatistics) {
            $this->statistics[$index] = [];
            $this->statistic =& $this->statistics[$index];
        }
    }
1337546
public function undo()
    {
        end($this->history);
        for ($i=0; $i<$this->history_offset; $i++) {
            prev($this->history);
        }
        $index = prev($this->history);
        if (!empty($index)) {
            $this->current_passage = $index;
            $this->history_offset++;
            $this->storyline = array_slice($this->storyline, 0, -1);
            return $this->getCurrentPassage();
        }
        return false;
    }
667061
private function checkLogModels()
	{
		if (empty($this->Logger) && !empty(AuditableConfig::$Logger)) {
			$this->Logger = AuditableConfig::$Logger;
		}

		if (!($this->Logger instanceof Model)) {
			return false;
		}

		if ($this->Logger->Behaviors->attached('Auditable')) {
			$this->Logger->Behaviors->unload('Auditable');
		}

		if (!isset($this->Logger->LogDetail)) {
			return false;
		}

		if ($this->Logger->LogDetail->Behaviors->attached('Auditable')) {
			$this->Logger->LogDetail->Behaviors->unload('Auditable');
		}

		return true;
	}
1174362
public function peek() {
        if (($this->char + 1) <= $this->EOF) {
            return $this->data[$this->char + 1];
        }

        return false;
    }
836301
protected function reconnect()
    {
        if ($this->connection->inTransaction()) {
            // It is not safe to blindly reconnect in the middle of a transaction
            return false;
        }

        try {
            // Make sure we free any resources associated with the old connection
            $this->connection->disconnect();
        } catch (Exception $e) {
        }

        try {
            $this->connection->connect();
            $this->connection->log('[RECONNECT]');

            return true;
        } catch (Exception $e) {
            // If there was an error connecting again, don't report it back,
            // let the retry handler do it.
            return false;
        }
    }
340259
protected function trace()
    {
        foreach (\array_reverse($this->backtrace) as $stackFrame) {
            if ($this->isDebugCall($stackFrame)) {
                return $stackFrame;
            }
        }

        return \end($this->backtrace);
    }
1311963
protected function unBindUid()
    {
        if (empty($this->uid)) return;
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'unBindUid', 'uid' => $this->uid];
        } else {
            get_instance()->unBindUid($this->uid, $this->fd);
        }
    }
574526
public function startWithTrashed()
    {
        $this->reset(new Action(__METHOD__, [], Action::INTERNAL));

        $this->getCurrentPlan()->startWithTrashed();

        return $this;
    }
1287633
public function check()
    {
        $current = $this->getCurrentUptime();

        $inTrouble =
            $current['load_1'] > $this->target->maxLoad['load_1'] ||
            $current['load_5'] > $this->target->maxLoad['load_5'] ||
            $current['load_15'] > $this->target->maxLoad['load_15'];

        return $this->makeResult(! $inTrouble, $this->makeMessage($current));
    }