Checks if the token at position of $index corresponds to a linefeed.

@param File $sniffedFile file to be checked
@param int  $index position of current token in token list

@return bool
18520
protected function isLinefeedToken(File $sniffedFile, $index)
    {
        if (!$this->isWhitespaceToken($sniffedFile, $index))
        {
            return false;
        }

        $tokens = $sniffedFile->getTokens();

        return strpos($tokens[$index]['content'], chr(10), 0) !== false;
    }
1228376
private function match(array $wantedTokens, array $tokens, $index)
    {
        foreach ($wantedTokens as $wantedToken) {
            $token = $tokens[$index];
            if (!$token->isSameAs($wantedToken)) {
                return false;
            }
            $index++;
        }

        return $index - 1;
    }
1265377
private function changeDelimiters($text, $index)
    {
        $startIndex = strpos($text, '=', $index) + 1;
        $close      = '=' . $this->ctag;
        $closeIndex = strpos($text, $close, $index);

        $this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));

        $this->tokens[] = array(
            self::TYPE => self::T_DELIM_CHANGE,
            self::LINE => $this->line,
        );

        return $closeIndex + strlen($close) - 1;
    }
1189048
public static function detect($index = 0)
    {
        $context = new Context();
        $backtrace = debug_backtrace();
        $position = $backtrace[$index];
        if (isset($position['file'])) {
            $context->filename = $position['file'];
        }
        if (isset($position['line'])) {
            $context->line = $position['line'];
        }
        $caller = isset($backtrace[$index + 1]) ? $backtrace[$index + 1] : null;
        if (isset($caller['function'])) {
            $context->method = $caller['function'];
            if (isset($caller['type']) && $caller['type'] === '::') {
                $context->static = true;
            }
        }
        if (isset($caller['class'])) {
            $fqn = explode('\\', $caller['class']);
            $context->class = array_pop($fqn);
            if (count($fqn)) {
                $context->namespace = implode('\\', $fqn);
            }
        }

        // @todo extract namespaces and use statements
        return $context;
    }
568230
private boolean isAtEOL() {
		int next = skipLineSpace(index);
		return next >= tokens.size() || tokens.get(next).kind == NewLine;
	}
846720
public function isFocused( $index = NULL ){
		if( !count( $this->focusedIndices ) )
			return FALSE;
		if( $index && !array_key_exists( $index, $this->focusedIndices ) )
			return FALSE;
		return TRUE;
	}
288950
private function methodNeedsDocBlock(File $sniffedFile, $index)
    {
        $methodName = $sniffedFile->getDeclarationName($index);

        return !in_array($methodName, $this->methodNamesWithoutNecessaryDocBlock, true);
    }
1260761
protected function _assignLine($index, $node, $line)
    {
        if ($node->lines['start'] === null) {
            $node->lines['start'] = $index;
        }
        $node->lines['stop'] = $index;
        if (trim($line)) {
            $this->_root->lines['content'][$index]['nodes'][] = $node;
        }
    }
847000
public function hasItem($index)
    {
        if (is_string($index) and in_array($index, $this->childNodesEntities)) {
            if (false !== ($key = array_search($index, $this->childNodesEntities))) {
                if ($this->childNodes->offsetExists($key)) {
                    return true;
                }
            }
        }

        return false;
    }
951248
protected function getLastWhitespaceOfPreviousLine(array $tokens, $index) {
		$currentLine = $tokens[$index]['line'];
		$index--;
		while ($tokens[$index]['line'] === $currentLine) {
			$index--;
		}

		return $index;
	}
703210
public static function offset(array $tokens, $index)
    {
        if (count($tokens) < 1) {
            return 0;
        }

        if (null === $index) {
            $index = count($tokens) - 1;
        }

        $source = '';

        for ($i = 0; $i < $index; ++$i) {
            $source .= $tokens[$i]->content();
        }

        return strlen($source);
    }
723484
function sniffLineEndings(text) {
        var subset = text.substr(0, 1000);  // (length is clipped to text.length)
        var hasCRLF = /\r\n/.test(subset);
        var hasLF = /[^\r]\n/.test(subset);

        if ((hasCRLF && hasLF) || (!hasCRLF && !hasLF)) {
            return null;
        } else {
            return hasCRLF ? LINE_ENDINGS_CRLF : LINE_ENDINGS_LF;
        }
    }
478159
protected function _shouldIgnoreLine($lineIndex, $testable) {
		$lines = $testable->lines();
		$line = $lines[$lineIndex];
		$plain = trim($line);

		if (empty($plain)) {
			return true;
		}

		$length = strlen($plain);
		if ($length > 1 && ($plain[0] . $plain[1] === "//")) {
			return true;
		} elseif ($length > 2 && ($plain[0] . $plain[1] . $plain[2] === "/**")) {
			return true;
		} elseif ($plain[0] === "#" || $plain[0] === "*") {
			return true;
		}

		$stringTokens = array(T_ENCAPSED_AND_WHITESPACE, T_END_HEREDOC);
		$tokens = $testable->tokens();
		$start = $testable->findTokenByLine($lineIndex + 1);
		return in_array($tokens[$start]['id'], $stringTokens, true);
	}
239630
protected final Token lookahead(int index) throws ScanException, ParseException {
		if (lookahead.isEmpty()) {
			lookahead = new LinkedList<LookaheadToken>();
		}
		while (index >= lookahead.size()) {
			lookahead.add(new LookaheadToken(scanner.next(), scanner.getPosition()));
		}
		return lookahead.get(index).token;
	}
1089043
protected static function readUpdateToken( $tokenFile )
    {
        $sys = eZSys::instance();
        $updateViewLogPath = $sys->varDirectory() . "/" . eZPerfLoggerINI::variable( 'FileSettings', 'LogDir', 'site.ini' ) . "/" . $tokenFile;
        if ( is_file( $updateViewLogPath ) )
        {
            // nb: we need the newline at the end of the saved line for a proper comparison
            $lines = file( $updateViewLogPath, FILE_SKIP_EMPTY_LINES );
            return isset( $lines[2] ) ? $lines[2] : false;
        }
        return false;
    }
484307
protected function applyFix(File $phpCsFile,
		$index,
		$leftIndexStart,
		$leftIndexEnd,
		$rightIndexStart,
		$rightIndexEnd) {
		$tokens = $phpCsFile->getTokens();

		$token = $tokens[$index];
		// Check if we need to inverse comparison operator
		$comparisonValue = $this->getComparisonValue($token);

		$phpCsFile->fixer->beginChangeset();

		$leftValue = '';
		for ($i = $leftIndexStart; $i <= $leftIndexEnd; ++$i) {
			$leftValue .= $tokens[$i]['content'];
			$phpCsFile->fixer->replaceToken($i, '');
		}
		$rightValue = '';
		for ($i = $rightIndexStart; $i <= $rightIndexEnd; ++$i) {
			$rightValue .= $tokens[$i]['content'];
			$phpCsFile->fixer->replaceToken($i, '');
		}

		$phpCsFile->fixer->replaceToken($index, $comparisonValue);
		$phpCsFile->fixer->replaceToken($leftIndexEnd, $rightValue);
		$phpCsFile->fixer->replaceToken($rightIndexStart, $leftValue);

		$phpCsFile->fixer->endChangeset();
	}
602690
protected function findUnnecessaryTrailingComparisonEnd(File $phpcsFile, int $index): ?int
    {
        $tokens = $phpcsFile->getTokens();

        $next = (int)$phpcsFile->findNext(T_WHITESPACE, ($index + 1), null, true);
        if (!$next || !in_array($tokens[$next]['code'], [T_IS_IDENTICAL, T_IS_NOT_IDENTICAL])) {
            return null;
        }

        $next = (int)$phpcsFile->findPrevious(T_WHITESPACE, ($next - 1), null, true);
        if (!$next || !in_array($tokens[$next]['code'], [T_TRUE, T_FALSE])) {
            return null;
        }

        return $next;
    }