Assert that string length is between min,max lengths.
public static betweenLength ( mixed $value, integer $minLength, integer $maxLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean | ||
$value | mixed | |
$minLength | integer | |
$maxLength | integer | |
$message | string | null | |
$propertyPath | string | null | |
$encoding | string | |
return | boolean |
public function testValidBetweenLength() { Assertion::betweenLength("foo", 0, 3); Assertion::betweenLength("址址", 2, 2); }
/** * @param $password */ public function setPassword($password) { Assertion::betweenLength($password, self::MIN, self::MAX); $this->password = HashedPassword::make($password, $this->hasher); }