/** * Returns <b>true</b> if the given node should be part of the node iterator, * otherwise this method will return <b>false</b>. * * @param PHP_Depend_Code_NodeI $node The context node instance. * * @return boolean */ public function accept(PHP_Depend_Code_NodeI $node) { $package = null; // NOTE: This looks a little bit ugly and it seems better to exclude // PHP_Depend_Code_Method and PHP_Depend_Code_Property, but when // PDepend supports more node types, this could produce errors. if ($node instanceof PHP_Depend_Code_AbstractClassOrInterface) { $package = $node->getPackage()->getName(); } else { if ($node instanceof PHP_Depend_Code_Function) { $package = $node->getPackage()->getName(); } else { if ($node instanceof PHP_Depend_Code_Package) { $package = $node->getName(); } } } return preg_match($this->_pattern, $package) === 0; }