@@ -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)); |
@@ -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"); |
@@ -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) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return iterator_to_array($generator); |
103 | 103 | } |
104 | 104 | |
105 | - private static function fields(): ?array |
|
105 | + private static function fields(): ? array |
|
106 | 106 | { |
107 | 107 | return isset(static::$fields) ? static::$fields : null; |
108 | 108 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | if ($fields) { |
114 | 114 | $data = array_filter( |
115 | 115 | $data, |
116 | - function ($key) use ($fields) { |
|
116 | + function($key) use ($fields) { |
|
117 | 117 | return in_array($key, $fields); |
118 | 118 | }, |
119 | 119 | ARRAY_FILTER_USE_KEY |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return self::$settings[$environment][$config_name]; |
57 | 57 | } |
58 | 58 | |
59 | - public static function grab(?string $environment = null): array |
|
59 | + public static function grab(? string $environment = null) : array |
|
60 | 60 | { |
61 | 61 | if (is_null($environment)) { |
62 | 62 | $environment = static::current(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param mixed $value |
75 | 75 | * @param null|string $environment if not specified, configures CURRENT environment only. E::ALL, sets for all envs. |
76 | 76 | */ |
77 | - public static function put(string $config_name, $value, ?string $environment = null): void |
|
77 | + public static function put(string $config_name, $value, ? string $environment = null) : void |
|
78 | 78 | { |
79 | 79 | if (is_null($environment)) { |
80 | 80 | $environment = static::current(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param array $configs |
99 | 99 | * @param null|string $environment |
100 | 100 | */ |
101 | - public static function add(array $configs, ?string $environment = null): void |
|
101 | + public static function add(array $configs, ? string $environment = null) : void |
|
102 | 102 | { |
103 | 103 | if (is_null($environment)) { |
104 | 104 | $environment = static::current(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param array $configs |
123 | 123 | * @param null|string $environment |
124 | 124 | */ |
125 | - public static function set(array $configs, ?string $environment = null): void |
|
125 | + public static function set(array $configs, ? string $environment = null) : void |
|
126 | 126 | { |
127 | 127 | if (is_null($environment)) { |
128 | 128 | $environment = static::current(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->route = Router::match($this->url, $this->method); |
63 | 63 | } |
64 | 64 | |
65 | - public function getHeader(string $name): ?string |
|
65 | + public function getHeader(string $name): ? string |
|
66 | 66 | { |
67 | 67 | return $this->headers[$name] ?? null; |
68 | 68 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param string $key Dot notation for deeper values, i.e. `user.email` |
173 | 173 | * @return mixed|null |
174 | 174 | */ |
175 | - public function session(?string $key = null) |
|
175 | + public function session(? string $key = null) |
|
176 | 176 | { |
177 | 177 | if (session_status() != PHP_SESSION_ACTIVE) { |
178 | 178 | session_start(); |
@@ -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); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ob_start(); |
170 | 170 | try { |
171 | 171 | // or another way to hide the file variable? |
172 | - (function ($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
172 | + (function($dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
173 | 173 | extract($this->data); |
174 | 174 | include $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd; |
175 | 175 | })($file); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param null|string $url |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - private function templateFromUrl(?string $url = null): string |
|
215 | + private function templateFromUrl(? string $url = null) : string |
|
216 | 216 | { |
217 | 217 | $parts = \explode('/', $url); |
218 | 218 | $last = \array_slice($parts, -1, 1, true); |