Valid sequence check.
@param string $prev token
@param string $current token
@return boolean checking result
431105
public function validSequence($prev, $current) {
        if(in_array($current, ['T_CONSTANT_ENCAPSED_STRING', 'T_LNUMBER', 'T_DNUMBER']))
            return in_array($prev, ['[', '(', ',', 'T_DOUBLE_ARROW']);
        elseif($current == 'T_DOUBLE_ARROW')
            return in_array($prev, ['T_CONSTANT_ENCAPSED_STRING', 'T_LNUMBER', 'T_DNUMBER']);
        elseif(in_array($current, [']', ')']))
            return in_array($prev, ['T_CONSTANT_ENCAPSED_STRING', 'T_LNUMBER', 'T_DNUMBER', ',', ']', ')']);
        elseif($current == ',')
            return in_array($prev, ['T_CONSTANT_ENCAPSED_STRING', 'T_LNUMBER', 'T_DNUMBER', 'T_STRING', ']', ')']);
        else
            return true;
    }
113612
function isFirstTokenInCurrentLine(token) {
            const tokenBefore = sourceCode.getTokenBefore(token);

            return !(tokenBefore && astUtils.isTokenOnSameLine(token, tokenBefore));
        }
204471
function inOrderPredecessor() {
        $current = $this->left();
        while ($current->right() !== null) {
            $current = $current->right();
        }
        return $current;
    }
297259
private Token token(Token prev) {
    if (curChar == EOF) {
      return null;
    }
    if (curChar == '{') {
      char nextChar = lookahead();
      if (nextChar == '{') {
        return leftCurlyBracket(prev);
      } else if (nextChar >= 'a' && nextChar <= 'z') {
        return key(prev);
      } else {
        throw new IllegalArgumentException(
            "Unexpected first character '" + nextChar + "'; must be lower case a-z.");
      }
    }
    return text(prev);
  }
489018
private static function significantAfter(int $index, array $sequence, int $count): int
    {
        for ($current = $index + 1; $current < $count; ++$current) {
            $token = $sequence[$current];

            if (\is_array($token) && \in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT, \T_WHITESPACE], true)) {
                continue;
            }

            return $current;
        }
    }
973459
public function setTitles($prev = "Prev", $next = "Next")
    {
        $this->options['prev_title'] = $prev;
        $this->options['next_title'] = $next;
        return $this;
    }
808228
public static function looksValidationy(RemoteException $prev)
    {
        $json = $prev->getJsonResponse();
        if ($prev->httpStatus == 400 && $json) {
            if (empty($json->version) || empty($json->errors) || empty($json->errors->message)) {
                return false;
            } else {
                return true;
            }
        } else {
            return false;
        }
    }
322129
public function needs_upgrade( $current = null, $last = null ) {

		if ( null === $current ) {
			$current = self::$version;
		}

		if ( null === $last ) {
			$last = self::$version_last;
		}

		$upgrade_needed = false;

		if ( ! empty( $current ) ) {
			foreach ( self::$upgrades as $old_version => $new_version ) {
				/*
				if ( '2.1.0' === $new_version && ( is_developer() ) )
					continue;*/

				if ( version_compare( $last, $old_version, '>=' ) && version_compare( $last, $new_version, '<' ) && version_compare( $current, $new_version, '>=' ) && 1 !== self::$upgraded ) {
					$upgrade_needed = true;

					break;
				}
			}
		}

		return $upgrade_needed;
	}
355817
public function validateToken(Token $token, int $currentTime = null)
    {

        $data = $this->getValidationData($currentTime);
        // @todo Add claims for validation
        return $token->validate($data);
    }
332124
protected function readToken(Token $prev): Token
    {
        $this->position = $prev->getEnd();

        $this->skipWhitespace();

        $line   = $this->line;
        $column = (1 + $this->position) - $this->lineStart;

        if ($this->position >= $this->bodyLength) {
            return $this->createEndOfFileToken($line, $column, $prev);
        }

        $code = $this->readCharCode($this->position);

        // Punctuation: [!$&:=@|()\[\]{}]{1}
        if (33 === $code || 36 === $code || 38 === $code || 58 === $code || 61 === $code || 64 === $code || 124 === $code ||
            40 === $code || 41 === $code || 91 === $code || 93 === $code || 123 === $code || 125 === $code) {
            return $this->lexPunctuation($code, $line, $column, $prev);
        }

        // Comment: #[\u0009\u0020-\uFFFF]*
        if (35 === $code) {
            return $this->lexComment($line, $column, $prev);
        }

        // Int:   -?(0|[1-9][0-9]*)
        // Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?
        if (45 === $code || isNumber($code)) {
            return $this->lexNumber($code, $line, $column, $prev);
        }

        // Name: [_A-Za-z][_0-9A-Za-z]*
        if (isAlphaNumeric($code)) {
            return $this->lexName($line, $column, $prev);
        }

        // Spread: ...
        if ($this->bodyLength >= 3 && $this->isSpread($code)) {
            return $this->lexSpread($line, $column, $prev);
        }

        // String: "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*"
        if ($this->isString($code)) {
            return $this->lexString($line, $column, $prev);
        }

        // Block String: """("?"?(\\"""|\\(?!=""")|[^"\\]))*"""
        if ($this->bodyLength >= 3 && $this->isTripleQuote($code)) {
            return $this->lexBlockString($line, $column, $prev);
        }

        throw $this->createSyntaxErrorException();
    }
287838
public function checkCurrentToken($id, $text = false) {
		$token = $this->getCurrentToken();
		return $this->checkToken($token, $id, $text);
	}
110440
private function _checkProhibitedKeywordsRegex($token) {
		if ($this->_isActive('checkProhibitedKeywordsRegex')) {

			foreach ($this->_prohibitedKeywordsRegex as $pattern) {

				preg_match_all($pattern, $token->text, $matches);
				$matches = $matches[0];
				if (!empty($matches)) {
					foreach ($matches as $key => $value) {
						$msg = $this->_getMessage('PROHIBITED_KEYWORD_REGEX', $value);
						$this->_writeError('checkProhibitedKeywordsRegex', $msg);
					}
				}
			}
		}
	}
350733
private function getSequenceParsed($text, $currentMode) {
        if ($this->tilde) {
            $sequence = '';
            $previousPos = 0;
            while (($pos = strpos($text, '~', $previousPos)) !== false) {
                $tildeData = self::extractTilde($text, $pos);

                $simpleTilde = ($tildeData === '~~');
                if ($simpleTilde && $currentMode !== 'B') {
                    throw new CINParseException('code128', 'The Table ' . $currentMode . ' doesn\'t contain the character ~.');
                }

                // At this point, we know we have ~Fx
                if ($tildeData !== '~F1' && $currentMode === 'C') {
                    // The mode C doesn't support ~F2, ~F3, ~F4
                    throw new CINParseException('code128', 'The Table C doesn\'t contain the function ' . $tildeData . '.');
                }

                $length = $pos - $previousPos;
                if ($currentMode === 'C') {
                    if ($length % 2 === 1) {
                        throw new CINParseException('code128', 'The text "' . $text . '" must have an even number of character to be encoded in Table C.');
                    }
                }

                $sequence .= str_repeat('.', $length);
                $sequence .= '.';
                $sequence .= (!$simpleTilde) ? 'F' : '';
                $previousPos = $pos + strlen($tildeData);
            }

            // Flushing
            $length = strlen($text) - $previousPos;
            if ($currentMode === 'C') {
                if ($length % 2 === 1) {
                    throw new CINParseException('code128', 'The text "' . $text . '" must have an even number of character to be encoded in Table C.');
                }
            }

            $sequence .= str_repeat('.', $length);

            return $sequence;
        } else {
            return str_repeat('.', strlen($text));
        }
    }
382272
protected function isSingleValuedPropertyDirty($type, $previousValue, $currentValue)
    {
        switch ($type) {
            case 'integer':
                if ($currentValue === (int) $previousValue) {
                    return false;
                }
            break;
            case 'float':
                if ($currentValue === (float) $previousValue) {
                    return false;
                }
            break;
            case 'boolean':
                if ($currentValue === (boolean) $previousValue) {
                    return false;
                }
            break;
            case 'string':
                if ($currentValue === (string) $previousValue) {
                    return false;
                }
            break;
            case 'DateTime':
                if ($currentValue instanceof \DateTimeInterface && $currentValue->getTimestamp() === (int) $previousValue) {
                    return false;
                }
            break;
            default:
                if (is_object($currentValue) && $this->getIdentifierByObject($currentValue) === $previousValue['identifier']) {
                    return false;
                }
            break;
        }
        return true;
    }
1255471
public function current($token = false)
    {
        if (!$this->valid()) {
            return null;
        }
        return $token ? $this->_data[$this->_current] : $this->_data[$this->_current][1];
    }
1157544
public function valid(\DateTime $now)
    {
        return parent::valid($now) && $this->getProcess() && !$this->isRunning();
    }
519183
def previous(time, base)
      current = time
      until match?(current, base) && current < time
        pot_prev = align(potential_previous(current, base), base)
        pot_prev -= min_step if pot_prev == current

        current = pot_prev
      end

      current
    end