private static function node_flatten(FilterNode $node, array $return, $isLeafOnly = false) { // TODO $isLeafOnly $childList = $node->getChildList(); // return data $tag = implode(',', $node->getTagList()); $return[$tag] = $node->getIssueSelection(); //echo "node [$tag] nbIssues = ".$node->getIssueSelection()->getNbIssues()."<br>"; // check if leaf if (NULL != $childList) { foreach ($childList as $childNode) { $return = self::node_flatten($childNode, $return, $isLeafOnly); } } return $return; }
/** * Dump filter node. * * @param FilterNode $node filter node * @param integer $level indentation level * * @return string */ protected function dumpFilter(FilterNode $node, $level = 0) { if (!isset($this->filters[$node->getName()])) { throw new Exception(sprintf('Filter with alias "%s" is not registered.', $node->getName())); } $text = ''; if ($node->getBlock()) { $text = $this->dumpNode($node->getBlock(), $level + 1); } return $this->filters[$node->getName()]->filter($text, $node->getAttributes(), str_repeat(' ', $level)); }
/** * Parse next filter token. * * @return FilterNode */ protected function parseFilter() { $block = null; $token = $this->expectTokenType('filter'); $attributes = $this->acceptTokenType('attributes'); if ('text' === $this->lexer->predictToken(2)->type) { $block = $this->parseTextBlock(); } else { $block = $this->parseBlock(); } $node = new FilterNode($token->value, null !== $attributes ? $attributes->attributes : array(), $this->lexer->getCurrentLine()); $node->setBlock($block); return $node; }
public function __construct($local_name, $ns_uri = null) { parent::__construct($local_name, $ns_uri); }