protected function findNodeIndex(Node $node)
    {

        foreach ($this->data as $i=>$added) {
            if ($added->getId() == $node->getId()) {
                return $i;
            }
        }

        // Not found? try it by spl_object_hash
        $nodeHash = spl_object_hash($node);

        foreach ($this->data as $i=>$added) {
            if (spl_object_hash($added) == $nodeHash) {
                return $i;
            }
        }

        return null;

    }
protected function findNodeIndex(Node $node)
    {

        foreach ($this->data as $i=>$added) {
            if ($added->getId() == $node->getId()) {
                return $i;
            }
        }

        // Not found? try it by spl_object_hash
        $nodeHash = spl_object_hash($node);

        foreach ($this->data as $i=>$added) {
            if (spl_object_hash($added) == $nodeHash) {
                return $i;
            }
        }

        return null;

    }
protected function findNodeIndex ( Node $ node ) { foreach ( $ this -> data as $ i => $ added ) { if ( $ added -> getId ( ) == $ node -> getId ( ) ) { return $ i ; } } // Not found? try it by spl_object_hash $ nodeHash = spl_object_hash ( $ node ) ; foreach ( $ this -> data as $ i => $ added ) { if ( spl_object_hash ( $ added ) == $ nodeHash ) { return $ i ; } } return null ; }
Try to find the node and returns its index

@param Node $node

@return int|null
Try to find the node and returns its index