From e26d360561b7e4f0edc5bc619d5803306ebb2937 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 28 Jul 2014 19:07:13 +0200 Subject: [PATCH] lib/Node: Remove method `findNodeBy()' The new `DocTree' class provides `getNode()'. --- library/Icinga/Data/Tree/Node.php | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/library/Icinga/Data/Tree/Node.php b/library/Icinga/Data/Tree/Node.php index b8f9e8dad..b57b0fad4 100644 --- a/library/Icinga/Data/Tree/Node.php +++ b/library/Icinga/Data/Tree/Node.php @@ -4,9 +4,6 @@ namespace Icinga\Data\Tree; -use Exception; -use RecursiveIteratorIterator; -use RuntimeException; use SplDoublyLinkedList; class Node extends SplDoublyLinkedList implements NodeInterface @@ -79,31 +76,4 @@ class Node extends SplDoublyLinkedList implements NodeInterface } return $current; } - - /** - * Find the first child node by searching through nodes deeper than the immediate children using a custom function - * - * @param $callback - * - * @return NodeInterface|null - * @throws Exception - */ - public function findNodeBy($callback) - { - if (! is_callable($callback)) { - throw new RuntimeException('Callable expected'); - } - foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $node) { - try { - $found = call_user_func($callback, $node); - } catch (Exception $e) { - // TODO(el): Log exception and return false instead? - throw $e; - } - if ($found) { - return $node; - } - } - return null; - } }