/**
  * Parses the text for a youtube bbcode node.
  * 
  * @param YoutubeBbcodeNode $node
  * @return YoutubeBbcodeNode
  */
 protected function parseYoutubeBbcodeNode(YoutubeBbcodeNode $node)
 {
     $first_rbracket_pos = strpos($this->_string, ']', $this->_pos - 1);
     if ($first_rbracket_pos !== false) {
         $end = stripos($this->_string, '[/youtube]', $this->_pos);
         if ($end !== false) {
             $url = substr($this->_string, $first_rbracket_pos + 1, $end - $first_rbracket_pos - 1);
             if (preg_match('#^[\\d\\w]{11}$#', $url)) {
                 $node->setVideoTag($url);
             } else {
                 if (preg_match("#v=([\\d\\w]{11})#", $url, $matches)) {
                     $node->setVideoTag($matches[1]);
                 }
             }
             $this->_pos = $end + 10;
         } else {
             // no end tag found: treat as text
         }
     } else {
         // no end bracket found: treat as text
     }
     return $this->_stack->pop();
 }
 public function test_isEmpty2()
 {
     $nnode = new YoutubeBbcodeNode();
     $this->assertTrue($nnode->isEmpty());
 }