original_string: public function find_item($id, $suppresserror = false) {
          if (isset($this->items)) {
              foreach ($this->items as $key => $child) {
                  if ($child->id == $id) {
                      return $this->items[$key];
                  }
              }
              foreach (array_keys($this->items) as $key) {
                  $thischild = $this->items[$key];
                  $ref = $thischild->children->find_item($id, true);//error always reported at top level
                  if ($ref !== null) {
                      return $ref;
                  }
              }
          }
  
          if (!$suppresserror) {
              print_error('listnoitem');
          }
          return null;
      }
code: public function find_item($id, $suppresserror = false) {
          if (isset($this->items)) {
              foreach ($this->items as $key => $child) {
                  if ($child->id == $id) {
                      return $this->items[$key];
                  }
              }
              foreach (array_keys($this->items) as $key) {
                  $thischild = $this->items[$key];
                  $ref = $thischild->children->find_item($id, true);//error always reported at top level
                  if ($ref !== null) {
                      return $ref;
                  }
              }
          }
  
          if (!$suppresserror) {
              print_error('listnoitem');
          }
          return null;
      }
code_tokens: public function find_item ( $ id , $ suppresserror = false ) { if ( isset ( $ this -> items ) ) { foreach ( $ this -> items as $ key => $ child ) { if ( $ child -> id == $ id ) { return $ this -> items [ $ key ] ; } } foreach ( array_keys ( $ this -> items ) as $ key ) { $ thischild = $ this -> items [ $ key ] ; $ ref = $ thischild -> children -> find_item ( $ id , true ) ; //error always reported at top level if ( $ ref !== null ) { return $ ref ; } } } if ( ! $ suppresserror ) { print_error ( 'listnoitem' ) ; } return null ; }
docstring: Recurse down the tree and find an item by it's id.
  
  @param integer $id
  @param boolean $suppresserror error if not item found?
  @return list_item *copy* or null if item is not found
docstring_tokens: Recurse down the tree and find an item by it s id .