You are here

private function DocParser::findInitialTokenPosition in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php \Doctrine\Common\Annotations\DocParser::findInitialTokenPosition()

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 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Parses the given docblock string for annotations.

File

modules/providers/service_container_annotation_discovery/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;
}