|
@@ 213-223 (lines=11) @@
|
| 210 |
|
* @throws RestrictionException |
| 211 |
|
* @return mixed |
| 212 |
|
*/ |
| 213 |
|
public static function checkLength($value, $length, $nativeType=null) |
| 214 |
|
{ |
| 215 |
|
if (static::getLength($value, $nativeType) != $length) { |
| 216 |
|
throw new RestrictionException( |
| 217 |
|
"The restriction length with '$length' is not true", |
| 218 |
|
RestrictionException::ERROR_CODE_LENGTH, |
| 219 |
|
$value, |
| 220 |
|
$length); |
| 221 |
|
} |
| 222 |
|
return $value; |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
/** |
| 226 |
|
* Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero |
|
@@ 234-244 (lines=11) @@
|
| 231 |
|
* @throws RestrictionException |
| 232 |
|
* @return mixed |
| 233 |
|
*/ |
| 234 |
|
public static function checkMaxLength($value, $maxLength, $nativeType=null) |
| 235 |
|
{ |
| 236 |
|
if (static::getLength($value, $nativeType) > $maxLength) { |
| 237 |
|
throw new RestrictionException( |
| 238 |
|
"The restriction max length with '$maxLength' is not true", |
| 239 |
|
RestrictionException::ERROR_CODE_MAX_LENGTH, |
| 240 |
|
$value, |
| 241 |
|
$maxLength); |
| 242 |
|
} |
| 243 |
|
return $value; |
| 244 |
|
} |
| 245 |
|
|
| 246 |
|
/** |
| 247 |
|
* Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero |
|
@@ 255-265 (lines=11) @@
|
| 252 |
|
* @throws RestrictionException |
| 253 |
|
* @return mixed |
| 254 |
|
*/ |
| 255 |
|
public static function checkMinLength($value, $minLength, $nativeType=null) |
| 256 |
|
{ |
| 257 |
|
if (static::getLength($value, $nativeType) < $minLength) { |
| 258 |
|
throw new RestrictionException( |
| 259 |
|
"The restriction min length with '$minLength' is not true", |
| 260 |
|
RestrictionException::ERROR_CODE_MIN_LENGTH, |
| 261 |
|
$value, |
| 262 |
|
$minLength); |
| 263 |
|
} |
| 264 |
|
return $value; |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
/** |
| 268 |
|
* Specifies the lower bounds for numeric values (the value must be greater than this value) |