public function get($key, $type=null) {
        if ($type !== null) {
            // If the type is known then we can simply check and fetch
            if (!empty($this->orderedcollection[$type][$key])) {
                return $this->orderedcollection[$type][$key];
            }
        } else {
            // Because we don't know the type we look in the progressive array
            foreach ($this->collection as $node) {
                if ($node->key === $key) {
                    return $node;
                }
            }
        }
        return false;
    }
public function get($key, $type=null) {
        if ($type !== null) {
            // If the type is known then we can simply check and fetch
            if (!empty($this->orderedcollection[$type][$key])) {
                return $this->orderedcollection[$type][$key];
            }
        } else {
            // Because we don't know the type we look in the progressive array
            foreach ($this->collection as $node) {
                if ($node->key === $key) {
                    return $node;
                }
            }
        }
        return false;
    }
public function get ( $ key , $ type = null ) { if ( $ type !== null ) { // If the type is known then we can simply check and fetch if ( ! empty ( $ this -> orderedcollection [ $ type ] [ $ key ] ) ) { return $ this -> orderedcollection [ $ type ] [ $ key ] ; } } else { // Because we don't know the type we look in the progressive array foreach ( $ this -> collection as $ node ) { if ( $ node -> key === $ key ) { return $ node ; } } } return false ; }
Fetches a node from this collection.

@param string|int $key The key of the node we want to find.
@param int $type One of navigation_node::TYPE_*.
@return navigation_node|null
Fetches a node from this collection .