@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | unset($options['with']); |
79 | 79 | $result = static::db()->find(static::table(), $conditions, $options); |
80 | 80 | $pk = static::pk(); |
81 | - $gen = function () use ($result, $pk, $with) { |
|
81 | + $gen = function() use ($result, $pk, $with) { |
|
82 | 82 | foreach ($result as $row) { |
83 | 83 | $model = new static($row); |
84 | 84 | if ($with) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return iterator_to_array($generator); |
113 | 113 | } |
114 | 114 | |
115 | - public static function fields(): ?array |
|
115 | + public static function fields(): ? array |
|
116 | 116 | { |
117 | 117 | return isset(static::$fields) ? static::$fields : null; |
118 | 118 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (empty($fields) === false) { |
124 | 124 | $data = array_filter( |
125 | 125 | $data, |
126 | - function ($key) use ($fields) { |
|
126 | + function($key) use ($fields) { |
|
127 | 127 | return in_array($key, $fields); |
128 | 128 | }, |
129 | 129 | ARRAY_FILTER_USE_KEY |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->data = $data; |
34 | 34 | } |
35 | 35 | |
36 | - abstract public static function fields(): ?array; |
|
36 | + abstract public static function fields(): ? array; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @param $name |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function __call(string $method, array $args = []) |
48 | 48 | { |
49 | - $refresh = (bool) array_shift($args); |
|
49 | + $refresh = (bool)array_shift($args); |
|
50 | 50 | return $this->getRelatedModel($method, $refresh); |
51 | 51 | } |
52 | 52 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | public function query($query, array $params = []); |
10 | 10 | |
11 | - public function one(string $table, array $conditions, array $options = []):?array; |
|
11 | + public function one(string $table, array $conditions, array $options = []): ? array; |
|
12 | 12 | |
13 | 13 | public function find(string $table, array $conditions, array $options = []); |
14 | 14 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | try { |
107 | 107 | $headfile = $this->getLayoutFile('head'); |
108 | 108 | if (file_exists($headfile)) { |
109 | - (function ($sldkfjlksejflskjflskdjflskdfj) { |
|
109 | + (function($sldkfjlksejflskjflskdjflskdfj) { |
|
110 | 110 | extract($this->data); |
111 | 111 | include $sldkfjlksejflskjflskdjflskdfj; |
112 | 112 | })($headfile); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $neckfile = $this->getLayoutFile('neck'); |
116 | 116 | if (file_exists($neckfile)) { |
117 | - (function ($lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
117 | + (function($lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
118 | 118 | extract($this->data); |
119 | 119 | include $lidsinqjhsdfytqkwjkasjdksadsdg; |
120 | 120 | })($neckfile); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | ob_start(); |
156 | 156 | try { |
157 | - (function ($ldkfoskdfosjicyvutwehkshfskjdf) { |
|
157 | + (function($ldkfoskdfosjicyvutwehkshfskjdf) { |
|
158 | 158 | extract($this->data); |
159 | 159 | include $ldkfoskdfosjicyvutwehkshfskjdf; |
160 | 160 | })($footfile); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ob_start(); |
179 | 179 | try { |
180 | 180 | // or another way to hide the file variable? |
181 | - (function ($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
181 | + (function($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
182 | 182 | extract($this->data); |
183 | 183 | include $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd; |
184 | 184 | })($file); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param null|string $url |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - private function templateFromUrl(?string $url = null): string |
|
222 | + private function templateFromUrl(?string $url = null) : string |
|
223 | 223 | { |
224 | 224 | $parts = \explode('/', $url); |
225 | 225 | $last = \array_slice($parts, -1, 1, true); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param Closure|null $close an optional anonymous function that takes the connection as arguments and closes it |
30 | 30 | * @throws InvalidArgumentException if connection $name already exists |
31 | 31 | */ |
32 | - public static function add(string $name, Closure $open, ?Closure $close = null): void |
|
32 | + public static function add(string $name, Closure $open, ?Closure $close = null) : void |
|
33 | 33 | { |
34 | 34 | if (isset(self::$open[$name])) { |
35 | 35 | throw new InvalidArgumentException("Connection $name already exists"); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return $result->fetchAll(_PDO::FETCH_ASSOC); |
77 | 77 | } |
78 | 78 | |
79 | - public function one(string $table, array $conditions, array $options = []): ?array |
|
79 | + public function one(string $table, array $conditions, array $options = []): ? array |
|
80 | 80 | { |
81 | 81 | $result = $this->find($table, $conditions, $options); |
82 | 82 | $result = iterator_to_array($result); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | if (empty($conditions)) { |
122 | 122 | return ""; |
123 | 123 | } |
124 | - $fun = function ($o, $v) { |
|
124 | + $fun = function($o, $v) { |
|
125 | 125 | return "{$o}{$v} = :c_{$v}"; |
126 | 126 | }; |
127 | 127 | $where = array_reduce(array_keys($conditions), $fun, ""); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | private function data(array $data): string |
188 | 188 | { |
189 | - $fun = function ($o, $v) { |
|
189 | + $fun = function($o, $v) { |
|
190 | 190 | return "{$o}{$v} = :d_{$v}"; |
191 | 191 | }; |
192 | 192 | return (string)array_reduce(array_keys($data), $fun, ""); |
@@ -79,7 +79,7 @@ |
||
79 | 79 | throw new \Exception("Query method is not implemented for MongDB"); |
80 | 80 | } |
81 | 81 | |
82 | - public function one(string $collection_name, array $conditions, array $options = []): ?array |
|
82 | + public function one(string $collection_name, array $conditions, array $options = []): ? array |
|
83 | 83 | { |
84 | 84 | $collection = $this->collection($collection_name); |
85 | 85 | $conditions = $this->idReplaceConditions($conditions); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // TODO cache of valid static routes, maybe with a try, catch, finally? |
72 | - return new Route($url, function (Request $request) { |
|
72 | + return new Route($url, function(Request $request) { |
|
73 | 73 | $page = response\Page::fromRequest($request); |
74 | 74 | if ($page->isValid()) { |
75 | 75 | return $page; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $parameters = array_filter( |
92 | 92 | $matches, |
93 | - function ($v) { |
|
93 | + function($v) { |
|
94 | 94 | return !is_int($v); |
95 | 95 | }, |
96 | 96 | \ARRAY_FILTER_USE_KEY |
@@ -196,7 +196,7 @@ |
||
196 | 196 | public function response(): ?Response |
197 | 197 | { |
198 | 198 | $cbs = $this->middlewares; |
199 | - $call_eventual_route_at_end_of_chain = function (Request $request, Chain $chain): ?Response { |
|
199 | + $call_eventual_route_at_end_of_chain = function(Request $request, Chain $chain): ?Response { |
|
200 | 200 | $route = $request->route(); |
201 | 201 | if (is_null($route)) { |
202 | 202 | throw new NoRouteSetError("Response called without Route set"); |