getEnd() public method

Get the end position of this annotation.
public getEnd ( ) : integer
return integer
コード例 #1
0
 /**
  * Get this docblock's annotations.
  *
  * @return Annotation[]
  */
 public function getAnnotations()
 {
     if (null === $this->annotations) {
         $this->annotations = array();
         $total = count($this->lines);
         for ($index = 0; $index < $total; ++$index) {
             if ($this->lines[$index]->containsATag()) {
                 // get all the lines that make up the annotation
                 $lines = array_slice($this->lines, $index, $this->findAnnotationLength($index), true);
                 $annotation = new Annotation($lines);
                 // move the index to the end of the annotation to avoid
                 // checking it again because we know the lines inside the
                 // current annotation cannot be part of another annotation
                 $index = $annotation->getEnd();
                 // add the current annotation to the list of annotations
                 $this->annotations[] = $annotation;
             }
         }
     }
     return $this->annotations;
 }
コード例 #2
0
 /**
  * Force the given annotations to have one empty line between each other.
  *
  * @param DocBlock   $doc
  * @param Annotation $first
  * @param Annotation $second
  */
 private function ensureAreSeparate(DocBlock $doc, Annotation $first, Annotation $second)
 {
     $pos = $first->getEnd();
     $final = $second->getStart() - 1;
     // check if we need to add a line, or need to remove one or more lines
     if ($pos === $final) {
         $doc->getLine($pos)->addBlank();
         return;
     }
     for ($pos = $pos + 1; $pos < $final; ++$pos) {
         $doc->getLine($pos)->remove();
     }
 }