original_string: protected function attach_nodes_to_categories() {
          foreach ($this->nodes as $node) {
              $parentcat = $node->parentcat;
              if (!isset($this->categories[$parentcat])) {
                  throw new \coding_exception("Category $parentcat doesn't exist");
              } else {
                  $this->categories[$parentcat]->add_node($node);
              }
          }
      }
code: protected function attach_nodes_to_categories() {
          foreach ($this->nodes as $node) {
              $parentcat = $node->parentcat;
              if (!isset($this->categories[$parentcat])) {
                  throw new \coding_exception("Category $parentcat doesn't exist");
              } else {
                  $this->categories[$parentcat]->add_node($node);
              }
          }
      }
code_tokens: protected function attach_nodes_to_categories ( ) { foreach ( $ this -> nodes as $ node ) { $ parentcat = $ node -> parentcat ; if ( ! isset ( $ this -> categories [ $ parentcat ] ) ) { throw new \ coding_exception ( "Category $parentcat doesn't exist" ) ; } else { $ this -> categories [ $ parentcat ] -> add_node ( $ node ) ; } } }
docstring: Attach various nodes to their respective categories.
  
  @throws \coding_exception
docstring_tokens: Attach various nodes to their respective categories .