original_string: public function remove($id)
      {
          $id   = $this->validateAndResolveId($id);
          $path = $this->items[$id][self::PATH];
  
          // remove item from hierarchy
          $this->hierarchy->remove($path);
          // remove item
          unset($this->items[$id]);
          $this->aliases->removeById($id);
          unset($this->blockThemes[$id]);
          // remove all children
          $pathLength    = count($path);
          $pathLastIndex = $pathLength - 1;
          $ids           = array_keys($this->items);
          foreach ($ids as $itemId) {
              $currentPath = $this->items[$itemId][self::PATH];
              if (count($currentPath) > $pathLength && $currentPath[$pathLastIndex] === $id) {
                  unset($this->items[$itemId]);
                  $this->aliases->removeById($itemId);
                  unset($this->blockThemes[$itemId]);
              }
          }
      }
code: public function remove($id)
      {
          $id   = $this->validateAndResolveId($id);
          $path = $this->items[$id][self::PATH];
  
          // remove item from hierarchy
          $this->hierarchy->remove($path);
          // remove item
          unset($this->items[$id]);
          $this->aliases->removeById($id);
          unset($this->blockThemes[$id]);
          // remove all children
          $pathLength    = count($path);
          $pathLastIndex = $pathLength - 1;
          $ids           = array_keys($this->items);
          foreach ($ids as $itemId) {
              $currentPath = $this->items[$itemId][self::PATH];
              if (count($currentPath) > $pathLength && $currentPath[$pathLastIndex] === $id) {
                  unset($this->items[$itemId]);
                  $this->aliases->removeById($itemId);
                  unset($this->blockThemes[$itemId]);
              }
          }
      }
code_tokens: public function remove ( $ id ) { $ id = $ this -> validateAndResolveId ( $ id ) ; $ path = $ this -> items [ $ id ] [ self :: PATH ] ; // remove item from hierarchy $ this -> hierarchy -> remove ( $ path ) ; // remove item unset ( $ this -> items [ $ id ] ) ; $ this -> aliases -> removeById ( $ id ) ; unset ( $ this -> blockThemes [ $ id ] ) ; // remove all children $ pathLength = count ( $ path ) ; $ pathLastIndex = $ pathLength - 1 ; $ ids = array_keys ( $ this -> items ) ; foreach ( $ ids as $ itemId ) { $ currentPath = $ this -> items [ $ itemId ] [ self :: PATH ] ; if ( count ( $ currentPath ) > $ pathLength && $ currentPath [ $ pathLastIndex ] === $ id ) { unset ( $ this -> items [ $ itemId ] ) ; $ this -> aliases -> removeById ( $ itemId ) ; unset ( $ this -> blockThemes [ $ itemId ] ) ; } } }
docstring: Removes the given item from the layout
  
  @param string $id The id of the layout item to be removed
  
  @throws Exception\InvalidArgumentException if the id is empty
  @throws Exception\ItemNotFoundException if the layout item does not exist
docstring_tokens: Removes the given item from the layout