_value; } /** * @param string $value */ public function setString($value) { $this->_value = $value; } function jsonSerialize() { return $this->_value; } public static function jsonDeserialize($json) { if (is_object($json) || is_array($json) || is_bool($json) || is_null($json)) { throw new LuDboDeserializeException("Invalid string value"); } $val = new self(); $val->setString($json . ""); return $val; } public static function generateSample() { return "sample string"; } protected function getLength($trim) { return strlen($trim ? trim($this->_value) : $this->_value); } public function between($min, $max, $trim = true) { $len = self::getLength($trim); if ($len < $min || $len > $max) { throw new LuDboConstraintException("String length must be between ${min} and ${max} inclusive"); } } public function min($min, $trim = true) { if (self::getLength($trim) < $min) { throw new LuDboConstraintException("String length must be greater or equal to ${min}"); } } public function max($max, $trim = true) { if (self::getLength($trim) > $max) { throw new LuDboConstraintException("String length must be smaller or equal to ${max}"); } } }