|
@@ 125-136 (lines=12) @@
|
| 122 |
|
* |
| 123 |
|
* @return bool |
| 124 |
|
*/ |
| 125 |
|
public function lengthBetween($field, $min, $max, $inclusive = false) |
| 126 |
|
{ |
| 127 |
|
$fieldValue = strlen(trim($this->get($field))); |
| 128 |
|
|
| 129 |
|
$valid = ($fieldValue <= $max && $fieldValue >= $min); |
| 130 |
|
|
| 131 |
|
if (!$inclusive) { |
| 132 |
|
$valid = ($fieldValue < $max && $fieldValue > $min); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
return ($valid === true) ?: $this->error($field, __FUNCTION__); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* Check to see if there is punctuation |
|
@@ 188-199 (lines=12) @@
|
| 185 |
|
* |
| 186 |
|
* @return bool |
| 187 |
|
*/ |
| 188 |
|
public function valueBetween($field, $min, $max, $inclusive = false) |
| 189 |
|
{ |
| 190 |
|
$fieldValue = $this->get($field); |
| 191 |
|
|
| 192 |
|
$valid = ($fieldValue <= $max && $fieldValue >= $min); |
| 193 |
|
|
| 194 |
|
if (!$inclusive) { |
| 195 |
|
$valid = ($fieldValue < $max && $fieldValue > $min); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
return ($valid === true) ?: $this->error($field, __FUNCTION__); |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
/** |
| 202 |
|
* Check if a field contains only decimal digit |