original_string: public function getNodesByIds($ids, $published = true)
      {
          if (empty($ids))
          {
              return null;
          }
  
          if (is_string($ids))
          {
              $ids = json_decode($ids, true);
          }
  
          if (is_array($ids) && ! empty($ids))
          {
              $placeholders = implode(',', array_fill(0, count($ids), '?'));
  
              $nodes = Node::whereIn('id', $ids)
                  ->orderByRaw('field(id,' . $placeholders . ')', $ids);
  
              if ($published)
              {
                  $nodes->published();
              }
  
              $nodes = $nodes->get();
  
              return (count($nodes) > 0) ? $nodes : null;
          }
  
          return null;
      }
code: public function getNodesByIds($ids, $published = true)
      {
          if (empty($ids))
          {
              return null;
          }
  
          if (is_string($ids))
          {
              $ids = json_decode($ids, true);
          }
  
          if (is_array($ids) && ! empty($ids))
          {
              $placeholders = implode(',', array_fill(0, count($ids), '?'));
  
              $nodes = Node::whereIn('id', $ids)
                  ->orderByRaw('field(id,' . $placeholders . ')', $ids);
  
              if ($published)
              {
                  $nodes->published();
              }
  
              $nodes = $nodes->get();
  
              return (count($nodes) > 0) ? $nodes : null;
          }
  
          return null;
      }
code_tokens: public function getNodesByIds ( $ ids , $ published = true ) { if ( empty ( $ ids ) ) { return null ; } if ( is_string ( $ ids ) ) { $ ids = json_decode ( $ ids , true ) ; } if ( is_array ( $ ids ) && ! empty ( $ ids ) ) { $ placeholders = implode ( ',' , array_fill ( 0 , count ( $ ids ) , '?' ) ) ; $ nodes = Node :: whereIn ( 'id' , $ ids ) -> orderByRaw ( 'field(id,' . $ placeholders . ')' , $ ids ) ; if ( $ published ) { $ nodes -> published ( ) ; } $ nodes = $ nodes -> get ( ) ; return ( count ( $ nodes ) > 0 ) ? $ nodes : null ; } return null ; }
docstring: Returns nodes by ids
  
  @param array|string $ids
  @param bool $published
  @return Collection
docstring_tokens: Returns nodes by ids