Returns the position of the previous whitespace or star of the comment for checking the line after that.

@param int $startPosition

@return int
420195
private function loadPrevDocBlockContent(int $startPosition): int
    {
        return $this->file->findPrevious(
            [
                T_DOC_COMMENT_OPEN_TAG,
                T_DOC_COMMENT_STAR,
                T_DOC_COMMENT_WHITESPACE,
            ],
            $startPosition - 1,
            $this->getDocCommentPos(),
            true
        );
    }
342482
def current_position(self):
        """"""
        token = self.tokenizer.peek(0)
        if token:
            return token.start, token.end

        return self.tokenizer.position, self.tokenizer.position + 1
249725
private static int findStart( char[] buffer, int start, int end )
    {
        int pos, cp;
        for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
        {
            if ( cp == '\n' )
            {
                start = pos + 1;
            }
        }
        return pos >= end ? end : start;
    }
591935
private function isNextLineEmpty(int $startPosition): bool
    {
        $istNextLineEmpty = true;
        $nextRelevantPos = $this->loadNextDocBlockContent($startPosition);

        if ($nextRelevantPos !== -1) {
            $istNextLineEmpty = $this->tokens[$startPosition]['line'] + 1 < $this->tokens[$nextRelevantPos]['line'];
        }

        return $istNextLineEmpty;
    }
1120234
public function compare(Position $position): int
    {
        if ($this->line === $position->line && $this->character === $position->character) {
            return 0;
        }

        if ($this->line !== $position->line) {
            return $this->line - $position->line;
        }

        return $this->character - $position->character;
    }
631163
@Override
  public int nextStartPosition() throws IOException {
    if (findMatches()) {
      currentMatch = queueMatches.get(0);
      currentPosition = currentMatch.startPosition();
      queueMatches.remove(0);
      return currentMatch.startPosition();
    } else {
      currentMatch = new Match(NO_MORE_POSITIONS, NO_MORE_POSITIONS);
      currentPosition = NO_MORE_POSITIONS;
      return NO_MORE_POSITIONS;
    }
  }
75946
@Override
  public int nextStartPosition() throws IOException {
    if (currentStartPosition < minPosition) {
      currentStartPosition = minPosition;
      currentEndPosition = currentStartPosition + 1;
    } else {
      currentStartPosition++;
      currentEndPosition = currentStartPosition + 1;
      if (currentStartPosition > maxPosition) {
        currentStartPosition = NO_MORE_POSITIONS;
        currentEndPosition = NO_MORE_POSITIONS;
      }
    }
    return currentStartPosition;
  }
1038538
protected function getTagEndIndex(array $tokens, int $start, int $end): int
    {
        for ($i = $end; $i > $start; $i--) {
            if ($tokens[$i]['code'] !== T_DOC_COMMENT_STRING) {
                continue;
            }

            return $i;
        }

        return $start;
    }
716339
private function isPrevLineEmpty(int $startPosition): bool
    {
        $isPrevLineEmpty = true;
        $posPrevContentPos = $this->loadPrevDocBlockContent($startPosition);

        if ($posPrevContentPos !== -1) {
            $isPrevLineEmpty = $this->tokens[$startPosition]['line'] - 1 > $this->tokens[$posPrevContentPos]['line'];
        }

        return $isPrevLineEmpty;
    }
1193268
public function getOffset($limit = self::LIMIT, $order = 'desc') {
		if ($limit === 0) {
			return 0;
		}
		if ($order == 'asc' || $order == 'time_created::asc') {
			$before = $this->getCommentsBefore(array('count' => true, 'offset' => 0));
		} else {
			$before = $this->getCommentsAfter(array('count' => true, 'offset' => 0));
		}
		
		return floor($before / $limit) * $limit;
	}
768473
def space_before?
      position = begin_pos.zero? ? begin_pos : begin_pos - 1
      pos.source_buffer.source.match(/\G\s/, position)
    end
999451
public function getExcerptStart($line)
    {
        if ($this->isExcerptOnly() === false) {
            return 1;
        }

        return max(1, $line - floor($this->getExcerptSize() / 2));
    }
636695
function isWhitespace( $tpl, &$text, $startPosition )
    {
        return ( $text[$startPosition] === ' '
                 or $text[$startPosition] === "\n"
                 or $text[$startPosition] === "\t"
                 or $text[$startPosition] === "\r" );
    }
38030
public function getLastEol($position = self::CURRENT_POSITION)
    {
        if (self::CURRENT_POSITION === $position) {
            $position = $this->position;
        }

        return strrpos(substr($this->data, 0, $position), "\n", 0);
    }
70224
private function checkLinesBeforeFirstUse(int $firstUsePos): void
    {
        $posBeforeFirstUse = TokenHelper::findPreviousExcluding($this->getFile(), T_WHITESPACE, $firstUsePos - 1);
        $realLinesBeforeUse = $this->getRealLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse);

        if ($realLinesBeforeUse !== self::LINES_BEFORE_FIRST_USE) {
            $fix = $this->getFile()->addFixableError(
                self::MESSAGE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                $firstUsePos,
                self::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                [
                    self::LINES_BEFORE_FIRST_USE,
                    $realLinesBeforeUse
                ]
            );

            if ($fix) {
                $this->fixLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse, self::LINES_BEFORE_FIRST_USE);
            }
        }
    }
595214
public function getTabByPosition($position)
    {
        if (is_numeric($position) && $position < count($this->tabs)) {
            return $this->tabs[$position];
        }

        return null;
    }
315078
public static function findCharPosition($string, $char, $start_at = 0)
    {
        $position = strpos($string, $char, $start_at);

        return ($position !== false) ? $position + 1 : null;
    }