original_string: protected function validate(array $rules, bool $throwError = true)
      {
          $validations = [];
          $data = [];
          foreach ($rules as $key => $rule) {
              $value = $this->request->get($key);
              $violations = $this->validator->validate($value, $rule);
              if (count($violations) > 0) {
                  $validations[$key] = [];
                  foreach ($violations as $violation) {
                      $validations[$key][] = $violation->getMessage();
                  }
              } else {
                  $data[$key] = $value;
              }
          }
          if ($throwError && count($validations)) {
              throw new HttpValidationException($validations);
          }
          return $data;
      }
code: protected function validate(array $rules, bool $throwError = true)
      {
          $validations = [];
          $data = [];
          foreach ($rules as $key => $rule) {
              $value = $this->request->get($key);
              $violations = $this->validator->validate($value, $rule);
              if (count($violations) > 0) {
                  $validations[$key] = [];
                  foreach ($violations as $violation) {
                      $validations[$key][] = $violation->getMessage();
                  }
              } else {
                  $data[$key] = $value;
              }
          }
          if ($throwError && count($validations)) {
              throw new HttpValidationException($validations);
          }
          return $data;
      }
code_tokens: protected function validate ( array $ rules , bool $ throwError = true ) { $ validations = [ ] ; $ data = [ ] ; foreach ( $ rules as $ key => $ rule ) { $ value = $ this -> request -> get ( $ key ) ; $ violations = $ this -> validator -> validate ( $ value , $ rule ) ; if ( count ( $ violations ) > 0 ) { $ validations [ $ key ] = [ ] ; foreach ( $ violations as $ violation ) { $ validations [ $ key ] [ ] = $ violation -> getMessage ( ) ; } } else { $ data [ $ key ] = $ value ; } } if ( $ throwError && count ( $ validations ) ) { throw new HttpValidationException ( $ validations ) ; } return $ data ; }
docstring: validate input value from request
  
  @param array $rules ['key' => [new NotBlank(), ...], ...]
  @param bool $throwError
  @return array
  @throws HttpValidationException
docstring_tokens: validate input value from request