@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ] |
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | - $this->add(function ($value, $nameKey) { |
|
| 48 | + $this->add(function($value, $nameKey) { |
|
| 49 | 49 | if (is_null($value)) { |
| 50 | 50 | return; |
| 51 | 51 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function token() |
| 66 | 66 | { |
| 67 | - return $this->add(function ($value, $nameKey) { |
|
| 67 | + return $this->add(function($value, $nameKey) { |
|
| 68 | 68 | preg_match('/[a-zA-Z0-9_]+/', $value, $matches); |
| 69 | 69 | if (!(isset($matches[0]) && ($matches[0] == $value))) { |
| 70 | 70 | $this->createError('string.token', $value, $nameKey); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function min($min) |
| 83 | 83 | { |
| 84 | - return $this->add(function ($value, $nameKey) use ($min) { |
|
| 84 | + return $this->add(function($value, $nameKey) use ($min) { |
|
| 85 | 85 | if (strlen($value) < $min) { |
| 86 | 86 | $this->createError('string.min', $value, $nameKey, $min); |
| 87 | 87 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function max($max) |
| 98 | 98 | { |
| 99 | - return $this->add(function ($value, $nameKey) use ($max) { |
|
| 99 | + return $this->add(function($value, $nameKey) use ($max) { |
|
| 100 | 100 | if (strlen($value) > $max) { |
| 101 | 101 | return $this->createError('string.max', $value, $nameKey, $max); |
| 102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function matches($regex) |
| 113 | 113 | { |
| 114 | - return $this->add(function ($value, $nameKey) use ($regex) { |
|
| 114 | + return $this->add(function($value, $nameKey) use ($regex) { |
|
| 115 | 115 | if (!preg_match($regex, $value)) { |
| 116 | 116 | return $this->createError('string.matches', $value, $nameKey, $regex); |
| 117 | 117 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function length($length) |
| 127 | 127 | { |
| 128 | - return $this->add(function ($value, $nameKey) use ($length) { |
|
| 128 | + return $this->add(function($value, $nameKey) use ($length) { |
|
| 129 | 129 | if (strlen($value) != $length) { |
| 130 | 130 | return $this->createError('string.length', $value, $nameKey, $length); |
| 131 | 131 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function alphanum() |
| 141 | 141 | { |
| 142 | - return $this->add(function ($value, $nameKey) { |
|
| 142 | + return $this->add(function($value, $nameKey) { |
|
| 143 | 143 | if (!ctype_alnum($value)) { |
| 144 | 144 | return $this->createError('string.alphanum', $value, $nameKey); |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function alpha() |
| 155 | 155 | { |
| 156 | - return $this->add(function ($value, $nameKey) { |
|
| 156 | + return $this->add(function($value, $nameKey) { |
|
| 157 | 157 | if (!ctype_alpha($value)) { |
| 158 | 158 | return $this->createError('string.alpha', $value, $nameKey); |
| 159 | 159 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function email() |
| 169 | 169 | { |
| 170 | - return $this->add(function ($value, $nameKey) { |
|
| 170 | + return $this->add(function($value, $nameKey) { |
|
| 171 | 171 | if (!filter_var($value, FILTER_VALIDATE_EMAIL)) { |
| 172 | 172 | return $this->createError('string.email', $value, $nameKey); |
| 173 | 173 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function creditCard() |
| 183 | 183 | { |
| 184 | - return $this->add(function ($value, $nameKey) { |
|
| 184 | + return $this->add(function($value, $nameKey) { |
|
| 185 | 185 | $i = strlen($value); |
| 186 | 186 | $sum = 0; |
| 187 | 187 | $mul = 1; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function ip() |
| 208 | 208 | { |
| 209 | - return $this->add(function ($value, $nameKey) { |
|
| 209 | + return $this->add(function($value, $nameKey) { |
|
| 210 | 210 | if (!filter_var($value, FILTER_VALIDATE_IP)) { |
| 211 | 211 | return $this->createError('string.ip', $value, $nameKey); |
| 212 | 212 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function uri() |
| 222 | 222 | { |
| 223 | - return $this->add(function ($value, $nameKey) { |
|
| 223 | + return $this->add(function($value, $nameKey) { |
|
| 224 | 224 | if (!filter_var($value, FILTER_VALIDATE_URL)) { |
| 225 | 225 | return $this->createError('string.uri', $value, $nameKey); |
| 226 | 226 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function replace($pattern, $replacement) |
| 239 | 239 | { |
| 240 | - return $this->add(function ($value, $nameKey) use ($pattern, $replacement) { |
|
| 240 | + return $this->add(function($value, $nameKey) use ($pattern, $replacement) { |
|
| 241 | 241 | return preg_replace($pattern, $replacement, $value); |
| 242 | 242 | }); |
| 243 | 243 | } |