original_string: public function isUnique(array $fields, $message = null)
      {
          $options = [];
          if (is_array($message)) {
              $options = $message + ['message' => null];
              $message = $options['message'];
              unset($options['message']);
          }
          if (!$message) {
              if ($this->_useI18n) {
                  $message = __d('cake', 'This value is already in use');
              } else {
                  $message = 'This value is already in use';
              }
          }
  
          $errorField = current($fields);
  
          return $this->_addError(new IsUnique($fields, $options), '_isUnique', compact('errorField', 'message'));
      }
code: public function isUnique(array $fields, $message = null)
      {
          $options = [];
          if (is_array($message)) {
              $options = $message + ['message' => null];
              $message = $options['message'];
              unset($options['message']);
          }
          if (!$message) {
              if ($this->_useI18n) {
                  $message = __d('cake', 'This value is already in use');
              } else {
                  $message = 'This value is already in use';
              }
          }
  
          $errorField = current($fields);
  
          return $this->_addError(new IsUnique($fields, $options), '_isUnique', compact('errorField', 'message'));
      }
code_tokens: public function isUnique ( array $ fields , $ message = null ) { $ options = [ ] ; if ( is_array ( $ message ) ) { $ options = $ message + [ 'message' => null ] ; $ message = $ options [ 'message' ] ; unset ( $ options [ 'message' ] ) ; } if ( ! $ message ) { if ( $ this -> _useI18n ) { $ message = __d ( 'cake' , 'This value is already in use' ) ; } else { $ message = 'This value is already in use' ; } } $ errorField = current ( $ fields ) ; return $ this -> _addError ( new IsUnique ( $ fields , $ options ) , '_isUnique' , compact ( 'errorField' , 'message' ) ) ; }
docstring: Returns a callable that can be used as a rule for checking the uniqueness of a value
  in the table.
  
  ### Example:
  
  ```
  $rules->add($rules->isUnique(['email'], 'The email should be unique'));
  ```
  
  @param array $fields The list of fields to check for uniqueness.
  @param string|array|null $message The error message to show in case the rule does not pass. Can
  also be an array of options. When an array, the 'message' key can be used to provide a message.
  @return callable
docstring_tokens: Returns a callable that can be used as a rule for checking the uniqueness of a value in the table .