@@ -16,8 +16,8 @@ |
||
16 | 16 | * @return $this |
17 | 17 | */ |
18 | 18 | public function having($expression) { |
19 | - if($expression instanceof OptionalExpression) { |
|
20 | - if($expression->isValid()) { |
|
19 | + if ($expression instanceof OptionalExpression) { |
|
20 | + if ($expression->isValid()) { |
|
21 | 21 | $this->having[] = [$expression->getExpression(), $expression->getData()]; |
22 | 22 | } |
23 | 23 | } else { |
@@ -27,8 +27,8 @@ |
||
27 | 27 | * @return DBExprFilter |
28 | 28 | */ |
29 | 29 | public function __invoke($expression, $keyPath, $validator = null) { |
30 | - return new DBExprFilter($expression, $this->map, $keyPath, $validator, function ($result, array $data) { |
|
31 | - if(!$result) { |
|
30 | + return new DBExprFilter($expression, $this->map, $keyPath, $validator, function($result, array $data) { |
|
31 | + if (!$result) { |
|
32 | 32 | throw new RequiredValueNotFoundException(sprintf("Required value %s not found", $data['key'])); |
33 | 33 | } |
34 | 34 | }); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | $this->value = $data; |
29 | 29 | $this->keyPath = $this->buildKey($keyPath); |
30 | 30 | $this->value = $this->recursiveGet($data, $this->keyPath, null); |
31 | - if($validator === null) { |
|
32 | - $validator = function ($data) { |
|
31 | + if ($validator === null) { |
|
32 | + $validator = function($data) { |
|
33 | 33 | return (string) $data !== ''; |
34 | 34 | }; |
35 | 35 | } |
36 | - if($validationResultHandler === null) { |
|
37 | - $validationResultHandler = function () {}; |
|
36 | + if ($validationResultHandler === null) { |
|
37 | + $validationResultHandler = function() {}; |
|
38 | 38 | } |
39 | 39 | $this->validator = $validator; |
40 | 40 | $this->validationResultHandler = $validationResultHandler; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @throws Exception |
73 | 73 | */ |
74 | 74 | private function buildKey($keyPath) { |
75 | - if(is_string($keyPath)) { |
|
75 | + if (is_string($keyPath)) { |
|
76 | 76 | $keyPath = explode('.', $keyPath); |
77 | 77 | } |
78 | - if(!is_array($keyPath)) { |
|
78 | + if (!is_array($keyPath)) { |
|
79 | 79 | throw new Exception('Invalid key'); |
80 | 80 | } |
81 | 81 | return $keyPath; |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | if (!$count) { |
93 | 93 | return $default; |
94 | 94 | } |
95 | - for($idx = 0; $idx < $count; $idx++) { |
|
95 | + for ($idx = 0; $idx < $count; $idx++) { |
|
96 | 96 | $part = $path[$idx]; |
97 | - if(!array_key_exists($part, $array)) { |
|
97 | + if (!array_key_exists($part, $array)) { |
|
98 | 98 | return $default; |
99 | 99 | } |
100 | 100 | $array = $array[$part]; |