original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Fetches a node from this collection .