original_string: public function email($field, $checkMX = false, $message = null, $when = null)
      {
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'email', $extra + [
              'rule' => ['email', $checkMX]
          ]);
      }
code: public function email($field, $checkMX = false, $message = null, $when = null)
      {
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'email', $extra + [
              'rule' => ['email', $checkMX]
          ]);
      }
code_tokens: public function email ( $ field , $ checkMX = false , $ message = null , $ when = null ) { $ extra = array_filter ( [ 'on' => $ when , 'message' => $ message ] ) ; return $ this -> add ( $ field , 'email' , $ extra + [ 'rule' => [ 'email' , $ checkMX ] ] ) ; }
docstring: Add an email validation rule to a field.
  
  @param string $field The field you want to apply the rule to.
  @param bool $checkMX Whether or not to check the MX records.
  @param string|null $message The error message when the rule fails.
  @param string|callable|null $when Either 'create' or 'update' or a callable that returns
  true when the validation rule should be applied.
  @see \Cake\Validation\Validation::email()
  @return $this
docstring_tokens: Add an email validation rule to a field .