public function test_isEmpty2() { $nnode = new ColorBbcodeNode(); $this->assertTrue($nnode->isEmpty()); }
/** * Parses the text inside a new color bbcode node. * * @param ColorBbcodeNode $node * @return ColorBbcodeNode */ protected function parseColorBbcodeNode(ColorBbcodeNode $node) { $first_rbracket_pos = strpos($this->_string, ']', $this->_pos - 1); $equal_pos = strpos($this->_string, '=', $this->_pos - 1); if ($first_rbracket_pos !== false && $equal_pos !== false && $equal_pos < $first_rbracket_pos) { $colorval = substr($this->_string, $equal_pos + 1, $first_rbracket_pos - $equal_pos - 1); if (preg_match('%^#?[0-9A-Fa-f]{6}$%', $colorval)) { // hexa color if (strpos($colorval, '#') === false) { $colorval = '#' . $colorval; } } $node->setColor($colorval); $this->_pos = $first_rbracket_pos + 1; $this->parseContent(); } // else treat as text return $node; }