@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function registerProperties() |
163 | 163 | { |
164 | - if (! static::$moduleConfig->shouldDiscover('registrars')) { |
|
164 | + if (!static::$moduleConfig->shouldDiscover('registrars')) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - if (! static::$didDiscovery) { |
|
168 | + if (!static::$didDiscovery) { |
|
169 | 169 | $locator = Services::locator(); |
170 | 170 | $registrarsFiles = $locator->search('Config/Registrar.php'); |
171 | 171 | |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | // Check the registrar class for a method named after this class' shortName |
183 | 183 | foreach (static::$registrars as $callable) { |
184 | 184 | // ignore non-applicable registrars |
185 | - if (! method_exists($callable, $shortName)) { |
|
185 | + if (!method_exists($callable, $shortName)) { |
|
186 | 186 | continue; // @codeCoverageIgnore |
187 | 187 | } |
188 | 188 | |
189 | 189 | $properties = $callable::$shortName(); |
190 | 190 | |
191 | - if (! is_array($properties)) { |
|
191 | + if (!is_array($properties)) { |
|
192 | 192 | throw new RuntimeException('Registrars must return an array of properties and their values.'); |
193 | 193 | } |
194 | 194 |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | return static::$mocks[$key]; |
183 | 183 | } |
184 | 184 | |
185 | - if (! isset(static::$instances[$key])) { |
|
185 | + if (!isset(static::$instances[$key])) { |
|
186 | 186 | // Make sure $getShared is false |
187 | 187 | $params[] = false; |
188 | 188 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected static function discoverServices(string $name, array $arguments) |
314 | 314 | { |
315 | - if (! static::$discovered) { |
|
315 | + if (!static::$discovered) { |
|
316 | 316 | $config = config('Modules'); |
317 | 317 | |
318 | 318 | if ($config->shouldDiscover('services')) { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | foreach ($files as $file) { |
329 | 329 | $classname = $locator->getClassname($file); |
330 | 330 | |
331 | - if (! in_array($classname, ['CodeIgniter\\Config\\Services'], true)) { |
|
331 | + if (!in_array($classname, ['CodeIgniter\\Config\\Services'], true)) { |
|
332 | 332 | static::$services[] = new $classname(); |
333 | 333 | } |
334 | 334 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | static::$discovered = true; |
338 | 338 | } |
339 | 339 | |
340 | - if (! static::$services) { |
|
340 | + if (!static::$services) { |
|
341 | 341 | // we found stuff, but no services - this would be really bad |
342 | 342 | return null; |
343 | 343 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | protected static function buildServicesCache(): void |
356 | 356 | { |
357 | - if (! static::$discovered) { |
|
357 | + if (!static::$discovered) { |
|
358 | 358 | $config = config('Modules'); |
359 | 359 | |
360 | 360 | if ($config->shouldDiscover('services')) { |
@@ -189,7 +189,7 @@ |
||
189 | 189 | return static::getSharedInstance('email', $config); |
190 | 190 | } |
191 | 191 | |
192 | - if (empty($config) || ! (is_array($config) || $config instanceof EmailConfig)) { |
|
192 | + if (empty($config) || !(is_array($config) || $config instanceof EmailConfig)) { |
|
193 | 193 | $config = config('Email'); |
194 | 194 | } |
195 | 195 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // Determine the component-specific options |
83 | 83 | $options = array_merge(self::getOptions(strtolower($component)), $options); |
84 | 84 | |
85 | - if (! $options['getShared']) { |
|
85 | + if (!$options['getShared']) { |
|
86 | 86 | if ($class = self::locateClass($options, $name)) { |
87 | 87 | return new $class(...$arguments); |
88 | 88 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // Try to locate the class |
106 | - if (! $class = self::locateClass($options, $name)) { |
|
106 | + if (!$class = self::locateClass($options, $name)) { |
|
107 | 107 | return null; |
108 | 108 | } |
109 | 109 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | |
148 | 148 | // Check if the class was namespaced |
149 | 149 | if (strpos($name, '\\') !== false) { |
150 | - if (! $file = $locator->locateFile($name, $options['path'])) { |
|
150 | + if (!$file = $locator->locateFile($name, $options['path'])) { |
|
151 | 151 | return null; |
152 | 152 | } |
153 | 153 | $files = [$file]; |
154 | 154 | } |
155 | 155 | // No namespace? Search for it |
156 | 156 | // Check all namespaces, prioritizing App and modules |
157 | - elseif (! $files = $locator->search($options['path'] . DIRECTORY_SEPARATOR . $name)) { |
|
157 | + elseif (!$files = $locator->search($options['path'] . DIRECTORY_SEPARATOR . $name)) { |
|
158 | 158 | return null; |
159 | 159 | } |
160 | 160 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | protected static function verifyPreferApp(array $options, string $name): bool |
180 | 180 | { |
181 | 181 | // Anything without that restriction passes |
182 | - if (! $options['preferApp']) { |
|
182 | + if (!$options['preferApp']) { |
|
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | protected static function verifyInstanceOf(array $options, string $name): bool |
201 | 201 | { |
202 | 202 | // Anything without that restriction passes |
203 | - if (! $options['instanceOf']) { |
|
203 | + if (!$options['instanceOf']) { |
|
204 | 204 | return true; |
205 | 205 | } |
206 | 206 |
@@ -22,12 +22,12 @@ |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | // Prevent access to BaseController |
25 | -$routes->add('BaseController(:any)', static function () { |
|
25 | +$routes->add('BaseController(:any)', static function() { |
|
26 | 26 | throw PageNotFoundException::forPageNotFound(); |
27 | 27 | }); |
28 | 28 | |
29 | 29 | // Prevent access to initController method |
30 | -$routes->add('(:any)/initController', static function () { |
|
30 | +$routes->add('(:any)/initController', static function() { |
|
31 | 31 | throw PageNotFoundException::forPageNotFound(); |
32 | 32 | }); |
33 | 33 |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | public function parse(): ?array |
52 | 52 | { |
53 | 53 | // We don't want to enforce the presence of a .env file, they should be optional. |
54 | - if (! is_file($this->path)) { |
|
54 | + if (!is_file($this->path)) { |
|
55 | 55 | return null; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Ensure the file is readable |
59 | - if (! is_readable($this->path)) { |
|
59 | + if (!is_readable($this->path)) { |
|
60 | 60 | throw new InvalidArgumentException("The .env file is not readable: {$this->path}"); |
61 | 61 | } |
62 | 62 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function setVariable(string $name, string $value = '') |
90 | 90 | { |
91 | - if (! getenv($name, true)) { |
|
91 | + if (!getenv($name, true)) { |
|
92 | 92 | putenv("{$name}={$value}"); |
93 | 93 | } |
94 | 94 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function sanitizeValue(string $value): string |
137 | 137 | { |
138 | - if (! $value) { |
|
138 | + if (!$value) { |
|
139 | 139 | return $value; |
140 | 140 | } |
141 | 141 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | if (strpos($value, '$') !== false) { |
191 | 191 | $value = preg_replace_callback( |
192 | 192 | '/\${([a-zA-Z0-9_\.]+)}/', |
193 | - function ($matchedPatterns) { |
|
193 | + function($matchedPatterns) { |
|
194 | 194 | $nestedVariable = $this->getVariable($matchedPatterns[1]); |
195 | 195 | |
196 | 196 | if ($nestedVariable === null) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $files = Services::locator()->search('Config/Events.php'); |
81 | 81 | } |
82 | 82 | |
83 | - $files = array_filter(array_map(static function (string $file) { |
|
83 | + $files = array_filter(array_map(static function(string $file) { |
|
84 | 84 | if (is_file($file)) { |
85 | 85 | return realpath($file) ?: $file; |
86 | 86 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public static function on($eventName, $callback, $priority = EVENT_PRIORITY_NORMAL) |
114 | 114 | { |
115 | - if (! isset(static::$listeners[$eventName])) { |
|
115 | + if (!isset(static::$listeners[$eventName])) { |
|
116 | 116 | static::$listeners[$eventName] = [ |
117 | 117 | true, // If there's only 1 item, it's sorted. |
118 | 118 | [$priority], |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public static function trigger($eventName, ...$arguments): bool |
138 | 138 | { |
139 | 139 | // Read in our Config/Events file so that we have them all! |
140 | - if (! static::$initialized) { |
|
140 | + if (!static::$initialized) { |
|
141 | 141 | static::initialize(); |
142 | 142 | } |
143 | 143 | |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public static function listeners($eventName): array |
174 | 174 | { |
175 | - if (! isset(static::$listeners[$eventName])) { |
|
175 | + if (!isset(static::$listeners[$eventName])) { |
|
176 | 176 | return []; |
177 | 177 | } |
178 | 178 | |
179 | 179 | // The list is not sorted |
180 | - if (! static::$listeners[$eventName][0]) { |
|
180 | + if (!static::$listeners[$eventName][0]) { |
|
181 | 181 | // Sort it! |
182 | 182 | array_multisort(static::$listeners[$eventName][1], SORT_NUMERIC, static::$listeners[$eventName][2]); |
183 | 183 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function removeListener($eventName, callable $listener): bool |
200 | 200 | { |
201 | - if (! isset(static::$listeners[$eventName])) { |
|
201 | + if (!isset(static::$listeners[$eventName])) { |
|
202 | 202 | return false; |
203 | 203 | } |
204 | 204 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected $escape = []; |
91 | 91 | |
92 | - public function __construct(?ConnectionInterface &$db = null, ?ValidationInterface $validation = null) |
|
92 | + public function __construct(?ConnectionInterface & $db = null, ?ValidationInterface $validation = null) |
|
93 | 93 | { |
94 | 94 | /** |
95 | 95 | * @var BaseConnection $db |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | // Require non empty primaryKey when |
227 | 227 | // not using auto-increment feature |
228 | - if (! $this->useAutoIncrement && empty($data[$this->primaryKey])) { |
|
228 | + if (!$this->useAutoIncrement && empty($data[$this->primaryKey])) { |
|
229 | 229 | throw DataException::forEmptyPrimaryKey('insert'); |
230 | 230 | } |
231 | 231 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | // If insertion succeeded then save the insert ID |
242 | 242 | if ($result) { |
243 | - $this->insertID = ! $this->useAutoIncrement ? $data[$this->primaryKey] : $this->db->insertID(); |
|
243 | + $this->insertID = !$this->useAutoIncrement ? $data[$this->primaryKey] : $this->db->insertID(); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $result; |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | foreach ($set as $row) { |
264 | 264 | // Require non empty primaryKey when |
265 | 265 | // not using auto-increment feature |
266 | - if (! $this->useAutoIncrement && empty($row[$this->primaryKey])) { |
|
266 | + if (!$this->useAutoIncrement && empty($row[$this->primaryKey])) { |
|
267 | 267 | throw DataException::forEmptyPrimaryKey('insertBatch'); |
268 | 268 | } |
269 | 269 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $builder = $builder->whereIn($this->primaryKey, $id); |
337 | 337 | } |
338 | 338 | |
339 | - if ($this->useSoftDeletes && ! $purge) { |
|
339 | + if ($this->useSoftDeletes && !$purge) { |
|
340 | 340 | if (empty($builder->getCompiledQBWhere())) { |
341 | 341 | if (CI_DEBUG) { |
342 | 342 | throw new DatabaseException( |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | return $data->{$this->primaryKey}; |
445 | 445 | } |
446 | 446 | |
447 | - if (is_array($data) && ! empty($data[$this->primaryKey])) { |
|
447 | + if (is_array($data) && !empty($data[$this->primaryKey])) { |
|
448 | 448 | return $data[$this->primaryKey]; |
449 | 449 | } |
450 | 450 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $builder = clone $this->builder(); |
469 | 469 | $rows = $builder->get($size, $offset); |
470 | 470 | |
471 | - if (! $rows) { |
|
471 | + if (!$rows) { |
|
472 | 472 | throw DataException::forEmptyDataset('chunk'); |
473 | 473 | } |
474 | 474 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $table = empty($table) ? $this->table : $table; |
539 | 539 | |
540 | 540 | // Ensure we have a good db connection |
541 | - if (! $this->db instanceof BaseConnection) { |
|
541 | + if (!$this->db instanceof BaseConnection) { |
|
542 | 542 | $this->db = Database::connect($this->DBGroup); |
543 | 543 | } |
544 | 544 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | */ |
611 | 611 | public function insert($data = null, bool $returnID = true) |
612 | 612 | { |
613 | - if (! empty($this->tempData['data'])) { |
|
613 | + if (!empty($this->tempData['data'])) { |
|
614 | 614 | if (empty($data)) { |
615 | 615 | $data = $this->tempData['data'] ?? null; |
616 | 616 | } else { |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function update($id = null, $data = null): bool |
638 | 638 | { |
639 | - if (! empty($this->tempData['data'])) { |
|
639 | + if (!empty($this->tempData['data'])) { |
|
640 | 640 | if (empty($data)) { |
641 | 641 | $data = $this->tempData['data'] ?? null; |
642 | 642 | } else { |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | |
669 | 669 | // Always grab the primary key otherwise updates will fail. |
670 | 670 | if ( |
671 | - method_exists($data, 'toRawArray') && (! empty($properties) && ! empty($this->primaryKey) && ! in_array($this->primaryKey, $properties, true) |
|
672 | - && ! empty($data->{$this->primaryKey})) |
|
671 | + method_exists($data, 'toRawArray') && (!empty($properties) && !empty($this->primaryKey) && !in_array($this->primaryKey, $properties, true) |
|
672 | + && !empty($data->{$this->primaryKey})) |
|
673 | 673 | ) { |
674 | 674 | $properties[$this->primaryKey] = $data->{$this->primaryKey}; |
675 | 675 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $properties = $data->toRawArray($onlyChanged); |
757 | 757 | |
758 | 758 | // Always grab the primary key otherwise updates will fail. |
759 | - if (! empty($properties) && ! empty($primaryKey) && ! in_array($primaryKey, $properties, true) && ! empty($data->{$primaryKey})) { |
|
759 | + if (!empty($properties) && !empty($primaryKey) && !in_array($primaryKey, $properties, true) && !empty($data->{$primaryKey})) { |
|
760 | 760 | $properties[$primaryKey] = $data->{$primaryKey}; |
761 | 761 | } |
762 | 762 | } else { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getPrevious() |
128 | 128 | { |
129 | - if (! $this->hasPrevious()) { |
|
129 | + if (!$this->hasPrevious()) { |
|
130 | 130 | return null; |
131 | 131 | } |
132 | 132 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getNext() |
162 | 162 | { |
163 | - if (! $this->hasNext()) { |
|
163 | + if (!$this->hasNext()) { |
|
164 | 164 | return null; |
165 | 165 | } |
166 | 166 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function getPreviousPage() |
283 | 283 | { |
284 | - if (! $this->hasPreviousPage()) { |
|
284 | + if (!$this->hasPreviousPage()) { |
|
285 | 285 | return null; |
286 | 286 | } |
287 | 287 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function getNextPage() |
315 | 315 | { |
316 | - if (! $this->hasNextPage()) { |
|
316 | + if (!$this->hasNextPage()) { |
|
317 | 317 | return null; |
318 | 318 | } |
319 | 319 |