@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @param string[] ...$relation_names any list of relations to return |
60 | - * @return instance of Entity object |
|
60 | + * @return Entity of Entity object |
|
61 | 61 | */ |
62 | 62 | public function with(string ...$relation_names) |
63 | 63 | { |
@@ -157,6 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @throws InvalidUrl |
160 | + * @param string $view |
|
160 | 161 | */ |
161 | 162 | public function view($view): string |
162 | 163 | { |
@@ -203,6 +204,9 @@ discard block |
||
203 | 204 | $this->template = "{$template}.{$this->type}"; |
204 | 205 | } |
205 | 206 | |
207 | + /** |
|
208 | + * @param string $url |
|
209 | + */ |
|
206 | 210 | private function templateFromUrl(?string $url = null): string |
207 | 211 | { |
208 | 212 | $parts = \explode('/', $url); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | try { |
95 | 95 | $headfile = $this->getLayoutFile('head'); |
96 | 96 | if (file_exists($headfile)) { |
97 | - (function ($sldkfjlksejflskjflskdjflskdfj) { |
|
97 | + (function($sldkfjlksejflskjflskdjflskdfj) { |
|
98 | 98 | extract($this->data); |
99 | 99 | include $sldkfjlksejflskjflskdjflskdfj; |
100 | 100 | })($headfile); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $neckfile = $this->getLayoutFile('neck'); |
104 | 104 | if (file_exists($neckfile)) { |
105 | - (function ($lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
105 | + (function($lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
106 | 106 | extract($this->data); |
107 | 107 | include $lidsinqjhsdfytqkwjkasjdksadsdg; |
108 | 108 | })($neckfile); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | ob_start(); |
144 | 144 | try { |
145 | - (function ($ldkfoskdfosjicyvutwehkshfskjdf) { |
|
145 | + (function($ldkfoskdfosjicyvutwehkshfskjdf) { |
|
146 | 146 | extract($this->data); |
147 | 147 | include $ldkfoskdfosjicyvutwehkshfskjdf; |
148 | 148 | })($footfile); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ob_start(); |
168 | 168 | try { |
169 | 169 | // or another way to hide the file variable? |
170 | - (function ($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
170 | + (function($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
171 | 171 | extract($this->data); |
172 | 172 | include $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd; |
173 | 173 | })($file); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->template = "{$template}.{$this->type}"; |
204 | 204 | } |
205 | 205 | |
206 | - private function templateFromUrl(?string $url = null): string |
|
206 | + private function templateFromUrl(? string $url = null) : string |
|
207 | 207 | { |
208 | 208 | $parts = \explode('/', $url); |
209 | 209 | $last = \array_slice($parts, -1, 1, true); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @param Closure|null $cb |
33 | 33 | * @param array $parameters |
34 | 34 | */ |
35 | - public function __construct(string $url, ?Closure $cb = null, array $parameters = []) |
|
35 | + public function __construct(string $url, ? Closure $cb = null, array $parameters = []) |
|
36 | 36 | { |
37 | 37 | $this->url = $url; |
38 | 38 | $this->callback = $cb; |
@@ -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 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | throw new \Exception("Query method is not implemented for MongDB"); |
79 | 79 | } |
80 | 80 | |
81 | - public function one(string $collection_name, array $conditions, array $options = []): ?array |
|
81 | + public function one(string $collection_name, array $conditions, array $options = []): ? array |
|
82 | 82 | { |
83 | 83 | $collection = $this->collection($collection_name); |
84 | 84 | $conditions = $this->idReplaceConditions($conditions); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | return $result->getModifiedCount(); |
130 | 130 | } |
131 | 131 | |
132 | - public function insert(string $collection, array $data, array $options = []): ?ObjectID |
|
132 | + public function insert(string $collection, array $data, array $options = []): ? ObjectID |
|
133 | 133 | { |
134 | 134 | $collection = $this->collection($collection); |
135 | 135 | $result = $collection->insertOne($data, $options); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return $result->fetchAll(PDO::FETCH_ASSOC); |
62 | 62 | } |
63 | 63 | |
64 | - public function one(string $table, array $conditions, array $options = []): ?array |
|
64 | + public function one(string $table, array $conditions, array $options = []): ? array |
|
65 | 65 | { |
66 | 66 | $result = $this->find($table, $conditions, $options); |
67 | 67 | $result = iterator_to_array($result); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (empty($conditions)) { |
124 | 124 | return ""; |
125 | 125 | } |
126 | - $fun = function ($o, $v) { |
|
126 | + $fun = function($o, $v) { |
|
127 | 127 | return "{$o}{$v} = :c_{$v}"; |
128 | 128 | }; |
129 | 129 | $where = array_reduce(array_keys($conditions), $fun, ""); |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | |
171 | 171 | private function data(array $data): string |
172 | 172 | { |
173 | - $fun = function ($o, $v) { |
|
173 | + $fun = function($o, $v) { |
|
174 | 174 | return "{$o}{$v} = :d_{$v}"; |
175 | 175 | }; |
176 | 176 | return array_reduce(array_keys($data), $fun, ""); |
177 | 177 | } |
178 | 178 | |
179 | - public function insert(string $table, array $data, array $options = []): ?int |
|
179 | + public function insert(string $table, array $data, array $options = []): ? int |
|
180 | 180 | { |
181 | 181 | $keys = implode(', ', array_keys($data)); |
182 | 182 | $data_phs = ':d_' . implode(', :d_', array_keys($data)); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // TODO cache of valid static routes, maybe with a try, catch, finally? |
65 | - return new Route($url, function (Request $request) { |
|
65 | + return new Route($url, function(Request $request) { |
|
66 | 66 | return response\Page::fromRequest($request); |
67 | 67 | }); |
68 | 68 | } |
69 | 69 | |
70 | - private static function matchDynamicRoute(string $url, string $method = Request::GET): ?Route |
|
70 | + private static function matchDynamicRoute(string $url, string $method = Request::GET): ? Route |
|
71 | 71 | { |
72 | 72 | foreach (static::$routes[$method] as $route => $cb) { |
73 | 73 | if ($route[0] !== substr($route, -1) || $route[0] !== static::$DELIMITER) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $parameters = array_filter( |
82 | 82 | $matches, |
83 | - function ($v) { |
|
83 | + function($v) { |
|
84 | 84 | return !is_int($v); |
85 | 85 | }, |
86 | 86 | ARRAY_FILTER_USE_KEY |
@@ -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"); |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | abstract class Response |
11 | 11 | { |
12 | 12 | public static $code_to_message = [ |
13 | - // Informational 1xx |
|
13 | + // Informational 1xx |
|
14 | 14 | 100 => 'Continue', |
15 | 15 | 101 => 'Switching Protocols', |
16 | - // Successful 2xx |
|
16 | + // Successful 2xx |
|
17 | 17 | 200 => 'OK', |
18 | 18 | 201 => 'Created', |
19 | 19 | 202 => 'Accepted', |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | 204 => 'No Content', |
22 | 22 | 205 => 'Reset Content', |
23 | 23 | 206 => 'Partial Content', |
24 | - // Redirection 3xx |
|
24 | + // Redirection 3xx |
|
25 | 25 | 300 => 'Multiple Choices', |
26 | 26 | 301 => 'Moved Permanently', |
27 | 27 | 302 => 'Found', |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 304 => 'Not Modified', |
30 | 30 | 305 => 'Use Proxy', |
31 | 31 | 307 => 'Temporary Redirect', |
32 | - // Client Error 4xx |
|
32 | + // Client Error 4xx |
|
33 | 33 | 400 => 'Bad Request', |
34 | 34 | 401 => 'Unauthorized', |
35 | 35 | 402 => 'Payment Required', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 415 => 'Unsupported Media Type', |
49 | 49 | 416 => 'Requested Range Not Satisfiable', |
50 | 50 | 417 => 'Expectation Failed', |
51 | - // Server Error 5xx |
|
51 | + // Server Error 5xx |
|
52 | 52 | 500 => 'Internal Server Error', |
53 | 53 | 501 => 'Not Implemented', |
54 | 54 | 502 => 'Bad Gateway', |