original_string: public function getById($id, $col = null)
      {
          $col = ($col) ?: $this->getPrimaryKey();
          $select = $this->getSelect()->where([$col => $id]);
          $resultSet = $this->fetchResult($select);
  
          if ($resultSet->count() > 1) {
              $rowSet = [];
              foreach ($resultSet as $row) {
                  $rowSet[] = $row;
              }
          } elseif ($resultSet->count() === 1) {
              $rowSet = $resultSet->current();
          } else {
              $rowSet = $this->getModel();
          }
  
          return $rowSet;
      }
code: public function getById($id, $col = null)
      {
          $col = ($col) ?: $this->getPrimaryKey();
          $select = $this->getSelect()->where([$col => $id]);
          $resultSet = $this->fetchResult($select);
  
          if ($resultSet->count() > 1) {
              $rowSet = [];
              foreach ($resultSet as $row) {
                  $rowSet[] = $row;
              }
          } elseif ($resultSet->count() === 1) {
              $rowSet = $resultSet->current();
          } else {
              $rowSet = $this->getModel();
          }
  
          return $rowSet;
      }
code_tokens: public function getById ( $ id , $ col = null ) { $ col = ( $ col ) ? : $ this -> getPrimaryKey ( ) ; $ select = $ this -> getSelect ( ) -> where ( [ $ col => $ id ] ) ; $ resultSet = $ this -> fetchResult ( $ select ) ; if ( $ resultSet -> count ( ) > 1 ) { $ rowSet = [ ] ; foreach ( $ resultSet as $ row ) { $ rowSet [ ] = $ row ; } } elseif ( $ resultSet -> count ( ) === 1 ) { $ rowSet = $ resultSet -> current ( ) ; } else { $ rowSet = $ this -> getModel ( ) ; } return $ rowSet ; }
docstring: Gets one or more rows by its id
  
  @param $id
  @param null|string $col
  @return array|ModelInterface
docstring_tokens: Gets one or more rows by its id