@@ -33,9 +33,9 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | - if (is_array($value) && isset($value['lat']) && isset($value['lng'])) { |
|
38 | + if (is_array($value) && isset($value[ 'lat' ]) && isset($value[ 'lng' ])) { |
|
39 | 39 | return true; |
40 | 40 | } |
41 | 41 |
@@ -33,15 +33,15 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | - $cmp = $params[0]; |
|
39 | - if($value >= $cmp){ |
|
38 | + $cmp = $params[ 0 ]; |
|
39 | + if ($value >= $cmp) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $message = "Value must be greater than or equal %s"; |
44 | - if($throw){ |
|
44 | + if ($throw) { |
|
45 | 45 | throw (new ValidationException($message, $cmp)); |
46 | 46 | } |
47 | 47 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | 38 | if (filter_var($value, FILTER_VALIDATE_MAC)) { |
39 | 39 | return true; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = false) |
|
36 | + public function validate($value, $params = [ ], $throw = false) |
|
37 | 37 | { |
38 | 38 | $cardArray = [ |
39 | 39 | 'default' => [ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // Check card type |
98 | 98 | $type = strtolower($type); |
99 | 99 | |
100 | - if (!isset($cards[$type])) { |
|
100 | + if (!isset($cards[ $type ])) { |
|
101 | 101 | if ($throw) { |
102 | 102 | throw new ValidationException($message); |
103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $length = strlen($number); |
110 | 110 | |
111 | 111 | // Validate the card length by the card type |
112 | - if (!in_array($length, preg_split('/\D+/', $cards[$type]['length']))) { |
|
112 | + if (!in_array($length, preg_split('/\D+/', $cards[ $type ][ 'length' ]))) { |
|
113 | 113 | if ($throw) { |
114 | 114 | throw new ValidationException($message); |
115 | 115 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // Check card number prefix |
121 | - if (!preg_match('/^' . $cards[$type]['prefix'] . '/', $number)) { |
|
121 | + if (!preg_match('/^'.$cards[ $type ][ 'prefix' ].'/', $number)) { |
|
122 | 122 | if ($throw) { |
123 | 123 | throw new ValidationException($message); |
124 | 124 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // No Luhn check required |
130 | - if ($cards[$type]['luhn'] == false) { |
|
130 | + if ($cards[ $type ][ 'luhn' ] == false) { |
|
131 | 131 | return true; |
132 | 132 | } |
133 | 133 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | // Force the value to be a string as this method uses string functions. |
148 | 148 | // Converting to an integer may pass PHP_INT_MAX and result in an error! |
149 | - $number = (string)$number; |
|
149 | + $number = (string) $number; |
|
150 | 150 | |
151 | 151 | if (!ctype_digit($number)) { |
152 | 152 | // Luhn can only be used on numbers! |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | 38 | if (filter_var($value, FILTER_VALIDATE_IP)) { |
39 | 39 | return true; |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | 38 | if (preg_match_all("/^[-+0-9()]+$/", $value)) { |
39 | 39 | return true; |
@@ -33,15 +33,15 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | - $cmp = $params[0]; |
|
39 | - if($value < $cmp){ |
|
38 | + $cmp = $params[ 0 ]; |
|
39 | + if ($value < $cmp) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $message = "Value must be less than %s"; |
44 | - if($throw){ |
|
44 | + if ($throw) { |
|
45 | 45 | throw (new ValidationException($message, $cmp)); |
46 | 46 | } |
47 | 47 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | - $limit = $params[0]; |
|
38 | + $limit = $params[ 0 ]; |
|
39 | 39 | $length = is_string($value) ? strlen($value) : count($value); |
40 | 40 | |
41 | - if($length <= $limit){ |
|
41 | + if ($length <= $limit) { |
|
42 | 42 | return true; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $message = "Value must be contain %s character at most"; |
46 | - if($throw){ |
|
46 | + if ($throw) { |
|
47 | 47 | throw (new ValidationException($message, $limit)); |
48 | 48 | } |
49 | 49 |
@@ -33,15 +33,15 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true) |
|
36 | + public function validate($value, $params = [ ], $throw = true) |
|
37 | 37 | { |
38 | - $cmp = $params[0]; |
|
39 | - if($value <= $cmp){ |
|
38 | + $cmp = $params[ 0 ]; |
|
39 | + if ($value <= $cmp) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $message = "Value must be less than or equal %s"; |
44 | - if($throw){ |
|
44 | + if ($throw) { |
|
45 | 45 | throw (new ValidationException($message, $cmp)); |
46 | 46 | } |
47 | 47 |