You are here

private function DocParser::findInitialTokenPosition in Plug 7

Finds the first valid annotation

Parameters

string $input The docblock string to parse:

Return value

int|null

1 call to DocParser::findInitialTokenPosition()
DocParser::parse in lib/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Parses the given docblock string for annotations.

File

lib/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php, line 344

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function findInitialTokenPosition($input) {
  $pos = 0;

  // search for first valid annotation
  while (($pos = strpos($input, '@', $pos)) !== false) {

    // if the @ is preceded by a space or * it is valid
    if ($pos === 0 || $input[$pos - 1] === ' ' || $input[$pos - 1] === '*') {
      return $pos;
    }
    $pos++;
  }
  return null;
}