original_string: public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
      if ($format === ServiceResponse::JSON) {
        $body = (object) array('errors'=>array());
      
        foreach ($list->getExceptions() as $validatorException) {
          $body->errors[$validatorException->field] = $validatorException->getMessage();
        }
      
        return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
      } else {
        $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
        
        return HTTPException::BadRequest(
            $list->getMessage(),
            $list,
            array_merge(
              array('Content-Type'=>'text/html'),
              $metadataGenerator->validationList($list)->toHeaders()
            )
        );
      }
    }
code: public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
      if ($format === ServiceResponse::JSON) {
        $body = (object) array('errors'=>array());
      
        foreach ($list->getExceptions() as $validatorException) {
          $body->errors[$validatorException->field] = $validatorException->getMessage();
        }
      
        return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
      } else {
        $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
        
        return HTTPException::BadRequest(
            $list->getMessage(),
            $list,
            array_merge(
              array('Content-Type'=>'text/html'),
              $metadataGenerator->validationList($list)->toHeaders()
            )
        );
      }
    }
code_tokens: public function validationResponse ( \ Psc \ Form \ ValidatorExceptionList $ list , $ format = ServiceResponse :: JSON , MetadataGenerator $ metadataGenerator = NULL ) { if ( $ format === ServiceResponse :: JSON ) { $ body = ( object ) array ( 'errors' => array ( ) ) ; foreach ( $ list -> getExceptions ( ) as $ validatorException ) { $ body -> errors [ $ validatorException -> field ] = $ validatorException -> getMessage ( ) ; } return HTTPResponseException :: BadRequest ( json_encode ( $ body ) , NULL , array ( 'Content-Type' => 'application/json' ) ) ; } else { $ metadataGenerator = $ metadataGenerator ? : new MetadataGenerator ( ) ; return HTTPException :: BadRequest ( $ list -> getMessage ( ) , $ list , array_merge ( array ( 'Content-Type' => 'text/html' ) , $ metadataGenerator -> validationList ( $ list ) -> toHeaders ( ) ) ) ; } }
docstring: Throws an ValidationResponse
  
  it handles the JSON case and the HTML case
  @param ValidatorException[]
  @param const $format im moment nur JSON oder HTML
  @return HTTPException
docstring_tokens: Throws an ValidationResponse