original_string: public function validateDataWithRules(array $data, array $validateRules, array $validateMessages = [], array $parametricConverter = [])
      {
          foreach ($validateRules as $key => $rules) {
              $value = array_key_exists($key, $data) ? $data[$key] : null;
  
              if (array_key_exists('nullable', $rules) && $rules['nullable'] && is_null($value)) {
                  continue;
              }
  
              unset($rules['nullable']);
  
              $defaultParametricConverter = (method_exists($this, 'getParametricConverter') && is_array($this->getParametricConverter())) ? $this->getParametricConverter() : [];
              $parametricConverter = array_merge($defaultParametricConverter, $parametricConverter);
              $parameter = (array_key_exists($key, $parametricConverter)) ? $parametricConverter[$key] : $key;
  
              foreach ($rules as $ruleName => $ruleParameter) {
                  if ($ruleName === 'callback') {
                      if (!is_callable($ruleParameter)) {
                          throw new BadMethodCallException('The reference of rule named `callback` must be a valid callable. You provided ' . $this->getValueDescription($ruleParameter) . '.');
                      }
  
                      call_user_func($ruleParameter, $value, InvalidRequestException::class);
                  } else {
                      $method = 'check'.ucfirst(Helper::camelCase($ruleName));
  
                      if (!method_exists($this, $method)) {
                          throw new BadMethodCallException('Call to undefined the ' .get_class($this). '::' .$method. '() validator that associated with the `' .$ruleName. '` rule');
                      }
  
                      if (!$this->$method($value, $ruleParameter)) {
                          $message = isset($validateMessages[$key][$ruleName]) ? $validateMessages[$key][$ruleName] : null;
  
                          throw new InvalidRequestException($this->formatMessage($parameter, $ruleName, $ruleParameter, $message));
                      }
                  }
              }
          }
      }
code: public function validateDataWithRules(array $data, array $validateRules, array $validateMessages = [], array $parametricConverter = [])
      {
          foreach ($validateRules as $key => $rules) {
              $value = array_key_exists($key, $data) ? $data[$key] : null;
  
              if (array_key_exists('nullable', $rules) && $rules['nullable'] && is_null($value)) {
                  continue;
              }
  
              unset($rules['nullable']);
  
              $defaultParametricConverter = (method_exists($this, 'getParametricConverter') && is_array($this->getParametricConverter())) ? $this->getParametricConverter() : [];
              $parametricConverter = array_merge($defaultParametricConverter, $parametricConverter);
              $parameter = (array_key_exists($key, $parametricConverter)) ? $parametricConverter[$key] : $key;
  
              foreach ($rules as $ruleName => $ruleParameter) {
                  if ($ruleName === 'callback') {
                      if (!is_callable($ruleParameter)) {
                          throw new BadMethodCallException('The reference of rule named `callback` must be a valid callable. You provided ' . $this->getValueDescription($ruleParameter) . '.');
                      }
  
                      call_user_func($ruleParameter, $value, InvalidRequestException::class);
                  } else {
                      $method = 'check'.ucfirst(Helper::camelCase($ruleName));
  
                      if (!method_exists($this, $method)) {
                          throw new BadMethodCallException('Call to undefined the ' .get_class($this). '::' .$method. '() validator that associated with the `' .$ruleName. '` rule');
                      }
  
                      if (!$this->$method($value, $ruleParameter)) {
                          $message = isset($validateMessages[$key][$ruleName]) ? $validateMessages[$key][$ruleName] : null;
  
                          throw new InvalidRequestException($this->formatMessage($parameter, $ruleName, $ruleParameter, $message));
                      }
                  }
              }
          }
      }
code_tokens: public function validateDataWithRules ( array $ data , array $ validateRules , array $ validateMessages = [ ] , array $ parametricConverter = [ ] ) { foreach ( $ validateRules as $ key => $ rules ) { $ value = array_key_exists ( $ key , $ data ) ? $ data [ $ key ] : null ; if ( array_key_exists ( 'nullable' , $ rules ) && $ rules [ 'nullable' ] && is_null ( $ value ) ) { continue ; } unset ( $ rules [ 'nullable' ] ) ; $ defaultParametricConverter = ( method_exists ( $ this , 'getParametricConverter' ) && is_array ( $ this -> getParametricConverter ( ) ) ) ? $ this -> getParametricConverter ( ) : [ ] ; $ parametricConverter = array_merge ( $ defaultParametricConverter , $ parametricConverter ) ; $ parameter = ( array_key_exists ( $ key , $ parametricConverter ) ) ? $ parametricConverter [ $ key ] : $ key ; foreach ( $ rules as $ ruleName => $ ruleParameter ) { if ( $ ruleName === 'callback' ) { if ( ! is_callable ( $ ruleParameter ) ) { throw new BadMethodCallException ( 'The reference of rule named `callback` must be a valid callable. You provided ' . $ this -> getValueDescription ( $ ruleParameter ) . '.' ) ; } call_user_func ( $ ruleParameter , $ value , InvalidRequestException :: class ) ; } else { $ method = 'check' . ucfirst ( Helper :: camelCase ( $ ruleName ) ) ; if ( ! method_exists ( $ this , $ method ) ) { throw new BadMethodCallException ( 'Call to undefined the ' . get_class ( $ this ) . '::' . $ method . '() validator that associated with the `' . $ ruleName . '` rule' ) ; } if ( ! $ this -> $ method ( $ value , $ ruleParameter ) ) { $ message = isset ( $ validateMessages [ $ key ] [ $ ruleName ] ) ? $ validateMessages [ $ key ] [ $ ruleName ] : null ; throw new InvalidRequestException ( $ this -> formatMessage ( $ parameter , $ ruleName , $ ruleParameter , $ message ) ) ; } } } } }
docstring: Validate data with defined rules
  
  @param  array  $data
  @param  array  $validateRules
  @param  array  $validateMessages
  @param  array  $parametricConverter
  @throws InvalidRequestException
  @throws BadMethodCallException
docstring_tokens: Validate data with defined rules