original_string: public function lengthBetween($field, array $range, $message = null, $when = null)
      {
          if (count($range) !== 2) {
              throw new InvalidArgumentException('The $range argument requires 2 numbers');
          }
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'lengthBetween', $extra + [
              'rule' => ['lengthBetween', array_shift($range), array_shift($range)],
          ]);
      }
code: public function lengthBetween($field, array $range, $message = null, $when = null)
      {
          if (count($range) !== 2) {
              throw new InvalidArgumentException('The $range argument requires 2 numbers');
          }
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'lengthBetween', $extra + [
              'rule' => ['lengthBetween', array_shift($range), array_shift($range)],
          ]);
      }
code_tokens: public function lengthBetween ( $ field , array $ range , $ message = null , $ when = null ) { if ( count ( $ range ) !== 2 ) { throw new InvalidArgumentException ( 'The $range argument requires 2 numbers' ) ; } $ extra = array_filter ( [ 'on' => $ when , 'message' => $ message ] ) ; return $ this -> add ( $ field , 'lengthBetween' , $ extra + [ 'rule' => [ 'lengthBetween' , array_shift ( $ range ) , array_shift ( $ range ) ] , ] ) ; }
docstring: Add an rule that ensures a string length is within a range.
  
  @param string $field The field you want to apply the rule to.
  @param array $range The inclusive minimum and maximum length you want permitted.
  @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::alphaNumeric()
  @return $this
docstring_tokens: Add an rule that ensures a string length is within a range .