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