original_string: public function getContentsBySlugsFunction($slugs, $keepOrder = false)
      {
          $search = $this->repository->createSearch();
          $search->addQuery(new TermsQuery('slug', $slugs), 'should');
  
          $result = $this->repository->execute($search);
  
          if ($keepOrder) {
              $orderedResult = [];
              foreach ($slugs as $slug) {
                  foreach ($result as $document) {
                      if ($document->slug == $slug) {
                          $orderedResult[] = $document;
                      }
                  }
              }
  
              $result = $orderedResult;
          }
  
          return $result;
      }
code: public function getContentsBySlugsFunction($slugs, $keepOrder = false)
      {
          $search = $this->repository->createSearch();
          $search->addQuery(new TermsQuery('slug', $slugs), 'should');
  
          $result = $this->repository->execute($search);
  
          if ($keepOrder) {
              $orderedResult = [];
              foreach ($slugs as $slug) {
                  foreach ($result as $document) {
                      if ($document->slug == $slug) {
                          $orderedResult[] = $document;
                      }
                  }
              }
  
              $result = $orderedResult;
          }
  
          return $result;
      }
code_tokens: public function getContentsBySlugsFunction ( $ slugs , $ keepOrder = false ) { $ search = $ this -> repository -> createSearch ( ) ; $ search -> addQuery ( new TermsQuery ( 'slug' , $ slugs ) , 'should' ) ; $ result = $ this -> repository -> execute ( $ search ) ; if ( $ keepOrder ) { $ orderedResult = [ ] ; foreach ( $ slugs as $ slug ) { foreach ( $ result as $ document ) { if ( $ document -> slug == $ slug ) { $ orderedResult [ ] = $ document ; } } } $ result = $ orderedResult ; } return $ result ; }
docstring: Return an array with content documents filtered by slugs array.
  
  @param array $slugs
  @param bool  $keepOrder
  
  @return mixed
docstring_tokens: Return an array with content documents filtered by slugs array .