original_string: public function ofType($type)
      {
          $items = [];
  
          foreach ($this->items as $path => $slug) {
              $page = $this->pages->get($path);
              if ($page !== null && $page->template() === $type) {
                  $items[$path] = $slug;
              }
          }
  
          $this->items = $items;
  
          return $this;
      }
code: public function ofType($type)
      {
          $items = [];
  
          foreach ($this->items as $path => $slug) {
              $page = $this->pages->get($path);
              if ($page !== null && $page->template() === $type) {
                  $items[$path] = $slug;
              }
          }
  
          $this->items = $items;
  
          return $this;
      }
code_tokens: public function ofType ( $ type ) { $ items = [ ] ; foreach ( $ this -> items as $ path => $ slug ) { $ page = $ this -> pages -> get ( $ path ) ; if ( $ page !== null && $ page -> template ( ) === $ type ) { $ items [ $ path ] = $ slug ; } } $ this -> items = $ items ; return $ this ; }
docstring: Creates new collection with only pages of the specified type
  
  @param string $type
  
  @return Collection The collection
docstring_tokens: Creates new collection with only pages of the specified type