original_string: private function prepareFields(array $fields)
      {
          $include = null;
          foreach ($fields as $key => $type) {
              $type = (bool) $type;
              if (null === $include) {
                  $include = $type;
              }
              if ($type !== $include) {
                  PersisterException::badRequest('Field projection mismatch. You cannot both exclude and include fields.');
              }
              $fields[$key] = $type;
          }
          return [$fields, $include];
      }
code: private function prepareFields(array $fields)
      {
          $include = null;
          foreach ($fields as $key => $type) {
              $type = (bool) $type;
              if (null === $include) {
                  $include = $type;
              }
              if ($type !== $include) {
                  PersisterException::badRequest('Field projection mismatch. You cannot both exclude and include fields.');
              }
              $fields[$key] = $type;
          }
          return [$fields, $include];
      }
code_tokens: private function prepareFields ( array $ fields ) { $ include = null ; foreach ( $ fields as $ key => $ type ) { $ type = ( bool ) $ type ; if ( null === $ include ) { $ include = $ type ; } if ( $ type !== $ include ) { PersisterException :: badRequest ( 'Field projection mismatch. You cannot both exclude and include fields.' ) ; } $ fields [ $ key ] = $ type ; } return [ $ fields , $ include ] ; }
docstring: Prepares projection fields for a query and returns as a tuple.
  
  @param   array   $fields
  @return  array
  @throws  PersisterException
docstring_tokens: Prepares projection fields for a query and returns as a tuple .