original_string: protected function innerSet($key, $val)
      {
          $setMethod = 'set' . ucfirst($key);
          if ( !in_array($key, $this->notsetters()) && method_exists($this, $setMethod) ) {
              $this->$setMethod($val);
          } else {
  
              $validateMethod = 'validate' . ucfirst($key);
  
              if (method_exists($this, $validateMethod)) {
  
                  $errors = new Exceptions();
  
                  try {
                      $validateResult = $this->$validateMethod($val);
                      if (false === $validateResult) {
                          return;
                      }
                      if ($validateResult instanceof \Generator) {
                          foreach ($validateResult as $error) {
                              if ($error instanceof \Throwable) {
                                  $errors->add($error);
                              }
                          }
                      }
                  } catch (\Throwable $e) {
                      $errors->add($e);
                  }
  
                  if (!$errors->empty()) {
                      throw $errors;
                  }
  
              }
  
              $sanitizeMethod = 'sanitize' . ucfirst($key);
              if (method_exists($this, $sanitizeMethod)) {
                  $val = $this->$sanitizeMethod($val);
              }
  
              if (null === $key) {
                  $this->__data[] = $val;
              } else {
                  $this->__data[$key] = $val;
              }
          }
      }
code: protected function innerSet($key, $val)
      {
          $setMethod = 'set' . ucfirst($key);
          if ( !in_array($key, $this->notsetters()) && method_exists($this, $setMethod) ) {
              $this->$setMethod($val);
          } else {
  
              $validateMethod = 'validate' . ucfirst($key);
  
              if (method_exists($this, $validateMethod)) {
  
                  $errors = new Exceptions();
  
                  try {
                      $validateResult = $this->$validateMethod($val);
                      if (false === $validateResult) {
                          return;
                      }
                      if ($validateResult instanceof \Generator) {
                          foreach ($validateResult as $error) {
                              if ($error instanceof \Throwable) {
                                  $errors->add($error);
                              }
                          }
                      }
                  } catch (\Throwable $e) {
                      $errors->add($e);
                  }
  
                  if (!$errors->empty()) {
                      throw $errors;
                  }
  
              }
  
              $sanitizeMethod = 'sanitize' . ucfirst($key);
              if (method_exists($this, $sanitizeMethod)) {
                  $val = $this->$sanitizeMethod($val);
              }
  
              if (null === $key) {
                  $this->__data[] = $val;
              } else {
                  $this->__data[$key] = $val;
              }
          }
      }
code_tokens: protected function innerSet ( $ key , $ val ) { $ setMethod = 'set' . ucfirst ( $ key ) ; if ( ! in_array ( $ key , $ this -> notsetters ( ) ) && method_exists ( $ this , $ setMethod ) ) { $ this -> $ setMethod ( $ val ) ; } else { $ validateMethod = 'validate' . ucfirst ( $ key ) ; if ( method_exists ( $ this , $ validateMethod ) ) { $ errors = new Exceptions ( ) ; try { $ validateResult = $ this -> $ validateMethod ( $ val ) ; if ( false === $ validateResult ) { return ; } if ( $ validateResult instanceof \ Generator ) { foreach ( $ validateResult as $ error ) { if ( $ error instanceof \ Throwable ) { $ errors -> add ( $ error ) ; } } } } catch ( \ Throwable $ e ) { $ errors -> add ( $ e ) ; } if ( ! $ errors -> empty ( ) ) { throw $ errors ; } } $ sanitizeMethod = 'sanitize' . ucfirst ( $ key ) ; if ( method_exists ( $ this , $ sanitizeMethod ) ) { $ val = $ this -> $ sanitizeMethod ( $ val ) ; } if ( null === $ key ) { $ this -> __data [ ] = $ val ; } else { $ this -> __data [ $ key ] = $ val ; } } }
docstring: This method is reloaded for on-set validation and sanitizing
  @param string $key
  @param mixed $val
  @throws \Runn\Core\Exceptions
docstring_tokens: This method is reloaded for on - set validation and sanitizing