Example #1
0
 /**
  * Construct token.
  * @param int $type
  * @param string $text
  * @param int $lineNo
  * @param int $newlineCount
  * @param int $colNo
  * @param int $byteOffset
  */
 public function __construct($type, $text, $lineNo = -1, $newlineCount = -1, $colNo = -1, $byteOffset = -1)
 {
     parent::__construct($type, $text, $lineNo, $newlineCount, $colNo, $byteOffset);
     $prefix = substr($text, 0, 3);
     if ($prefix === self::DOC) {
         $this->commentType = self::DOC;
     } else {
         $prefix = substr($prefix, 0, 2);
         if ($prefix === self::BLOCK) {
             $this->commentType = self::BLOCK;
         } elseif ($prefix === self::SINGLE) {
             $this->commentType = self::SINGLE;
         } elseif ($prefix[0] === self::HASH) {
             $this->commentType = self::HASH;
         }
     }
 }
Example #2
0
 public function setText($text)
 {
     $nl = FormatterFactory::getDefaultFormatter()->getConfig('nl');
     $this->newlineCount = substr_count($text, $nl);
     return parent::setText($text);
 }