@@ -39,7 +39,7 @@ |
||
39 | 39 | $refMethod->setAccessible(true); |
40 | 40 | $obj = (gettype($obj) === 'object') ? $obj : null; |
41 | 41 | |
42 | - return static function (...$args) use ($obj, $refMethod) { |
|
42 | + return static function(...$args) use ($obj, $refMethod) { |
|
43 | 43 | return $refMethod->invokeArgs($obj, $args); |
44 | 44 | }; |
45 | 45 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | parent::setUp(); |
233 | 233 | |
234 | - if (! $this->app) { |
|
234 | + if (!$this->app) { |
|
235 | 235 | $this->app = $this->createApplication(); |
236 | 236 | } |
237 | 237 | |
@@ -399,14 +399,13 @@ discard block |
||
399 | 399 | { |
400 | 400 | $found = false; |
401 | 401 | |
402 | - if (! function_exists('xdebug_get_headers')) { |
|
402 | + if (!function_exists('xdebug_get_headers')) { |
|
403 | 403 | $this->markTestSkipped('XDebug not found.'); |
404 | 404 | } |
405 | 405 | |
406 | 406 | foreach (xdebug_get_headers() as $emitted) { |
407 | 407 | $found = $ignoreCase ? |
408 | - (stripos($emitted, $header) === 0) : |
|
409 | - (strpos($emitted, $header) === 0); |
|
408 | + (stripos($emitted, $header) === 0) : (strpos($emitted, $header) === 0); |
|
410 | 409 | if ($found) { |
411 | 410 | break; |
412 | 411 | } |
@@ -427,20 +426,19 @@ discard block |
||
427 | 426 | { |
428 | 427 | $found = false; |
429 | 428 | |
430 | - if (! function_exists('xdebug_get_headers')) { |
|
429 | + if (!function_exists('xdebug_get_headers')) { |
|
431 | 430 | $this->markTestSkipped('XDebug not found.'); |
432 | 431 | } |
433 | 432 | |
434 | 433 | foreach (xdebug_get_headers() as $emitted) { |
435 | 434 | $found = $ignoreCase ? |
436 | - (stripos($emitted, $header) === 0) : |
|
437 | - (strpos($emitted, $header) === 0); |
|
435 | + (stripos($emitted, $header) === 0) : (strpos($emitted, $header) === 0); |
|
438 | 436 | if ($found) { |
439 | 437 | break; |
440 | 438 | } |
441 | 439 | } |
442 | 440 | |
443 | - $success = ! $found; |
|
441 | + $success = !$found; |
|
444 | 442 | $this->assertTrue($success, "Found header for {$header}"); |
445 | 443 | } |
446 | 444 | |
@@ -523,14 +521,13 @@ discard block |
||
523 | 521 | */ |
524 | 522 | protected function getHeaderEmitted(string $header, bool $ignoreCase = false): ?string |
525 | 523 | { |
526 | - if (! function_exists('xdebug_get_headers')) { |
|
524 | + if (!function_exists('xdebug_get_headers')) { |
|
527 | 525 | $this->markTestSkipped('XDebug not found.'); |
528 | 526 | } |
529 | 527 | |
530 | 528 | foreach (xdebug_get_headers() as $emitted) { |
531 | 529 | $found = $ignoreCase ? |
532 | - (stripos($emitted, $header) === 0) : |
|
533 | - (strpos($emitted, $header) === 0); |
|
530 | + (stripos($emitted, $header) === 0) : (strpos($emitted, $header) === 0); |
|
534 | 531 | if ($found) { |
535 | 532 | return $emitted; |
536 | 533 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $model = model($model, false); |
106 | 106 | } |
107 | 107 | |
108 | - if (! is_object($model)) { |
|
108 | + if (!is_object($model)) { |
|
109 | 109 | throw new InvalidArgumentException(lang('Fabricator.invalidModel')); |
110 | 110 | } |
111 | 111 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // Determine eligible date fields |
126 | 126 | foreach (['createdField', 'updatedField', 'deletedField'] as $field) { |
127 | - if (! empty($this->model->{$field})) { |
|
127 | + if (!empty($this->model->{$field})) { |
|
128 | 128 | $this->dateFields[] = $this->model->{$field}; |
129 | 129 | } |
130 | 130 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | { |
279 | 279 | $this->formatters = []; |
280 | 280 | |
281 | - if (! empty($this->model->allowedFields)) { |
|
281 | + if (!empty($this->model->allowedFields)) { |
|
282 | 282 | foreach ($this->model->allowedFields as $field) { |
283 | 283 | $this->formatters[$field] = $this->guessFormatter($field); |
284 | 284 | } |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | // Determine which fields we will need |
510 | 510 | $fields = []; |
511 | 511 | |
512 | - if (! empty($this->model->useTimestamps)) { |
|
512 | + if (!empty($this->model->useTimestamps)) { |
|
513 | 513 | $fields[$this->model->createdField] = $datetime; |
514 | 514 | $fields[$this->model->updatedField] = $datetime; |
515 | 515 | } |
516 | 516 | |
517 | - if (! empty($this->model->useSoftDeletes)) { |
|
517 | + if (!empty($this->model->useSoftDeletes)) { |
|
518 | 518 | $fields[$this->model->deletedField] = null; |
519 | 519 | } |
520 | 520 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // Clean up any open output buffers |
151 | 151 | // not relevant to unit testing |
152 | 152 | // @codeCoverageIgnoreStart |
153 | - if (\ob_get_level() > 0 && (! isset($this->clean) || $this->clean === true)) { |
|
153 | + if (\ob_get_level() > 0 && (!isset($this->clean) || $this->clean === true)) { |
|
154 | 154 | \ob_end_clean(); |
155 | 155 | } |
156 | 156 | // @codeCoverageIgnoreEnd |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $request = $this->setRequestBody($request); |
166 | 166 | |
167 | 167 | // Initialize the RouteCollection |
168 | - if (! $routes = $this->routes) { |
|
168 | + if (!$routes = $this->routes) { |
|
169 | 169 | require APPPATH . 'Config/Routes.php'; |
170 | 170 | |
171 | 171 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | ->run($routes, true); |
189 | 189 | |
190 | 190 | $output = \ob_get_contents(); |
191 | - if (empty($response->getBody()) && ! empty($output)) { |
|
191 | + if (empty($response->getBody()) && !empty($output)) { |
|
192 | 192 | $response->setBody($output); |
193 | 193 | } |
194 | 194 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | protected function setupHeaders(IncomingRequest $request) |
321 | 321 | { |
322 | - if (! empty($this->headers)) { |
|
322 | + if (!empty($this->headers)) { |
|
323 | 323 | foreach ($this->headers as $name => $value) { |
324 | 324 | $request->setHeader($name, $value); |
325 | 325 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | { |
343 | 343 | // $params should set the query vars if present, |
344 | 344 | // otherwise set it from the URL. |
345 | - $get = ! empty($params) && $method === 'get' |
|
345 | + $get = !empty($params) && $method === 'get' |
|
346 | 346 | ? $params |
347 | 347 | : $this->getPrivateProperty($request->uri, 'query'); |
348 | 348 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } elseif ($this->bodyFormat === 'xml') { |
385 | 385 | $formatMime = 'application/xml'; |
386 | 386 | } |
387 | - if (! empty($formatMime) && ! empty($params)) { |
|
387 | + if (!empty($formatMime) && !empty($params)) { |
|
388 | 388 | $formatted = Services::format()->getFormatter($formatMime)->format($params); |
389 | 389 | $request->setBody($formatted); |
390 | 390 | $request->setHeader('Content-Type', $formatMime); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() |
38 | 38 | { |
39 | - if (! extension_loaded('DOM')) { |
|
39 | + if (!extension_loaded('DOM')) { |
|
40 | 40 | // always there in travis-ci |
41 | 41 | // @codeCoverageIgnoreStart |
42 | 42 | throw new BadMethodCallException('DOM extension is required, but not currently loaded.'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // turning off some errors |
68 | 68 | libxml_use_internal_errors(true); |
69 | 69 | |
70 | - if (! $this->dom->loadHTML($content)) { |
|
70 | + if (!$this->dom->loadHTML($content)) { |
|
71 | 71 | // unclear how we would get here, given that we are trapping libxml errors |
72 | 72 | // @codeCoverageIgnoreStart |
73 | 73 | libxml_clear_errors(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function withFile(string $path) |
92 | 92 | { |
93 | - if (! is_file($path)) { |
|
93 | + if (!is_file($path)) { |
|
94 | 94 | throw new InvalidArgumentException(basename($path) . ' is not a valid file.'); |
95 | 95 | } |
96 | 96 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function dontSee(?string $search = null, ?string $element = null): bool |
128 | 128 | { |
129 | - return ! $this->see($search, $element); |
|
129 | + return !$this->see($search, $element); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -192,23 +192,23 @@ discard block |
||
192 | 192 | $path = ''; |
193 | 193 | |
194 | 194 | // By ID |
195 | - if (! empty($selector['id'])) { |
|
195 | + if (!empty($selector['id'])) { |
|
196 | 196 | $path = empty($selector['tag']) |
197 | 197 | ? "id(\"{$selector['id']}\")" |
198 | 198 | : "//{$selector['tag']}[@id=\"{$selector['id']}\"]"; |
199 | 199 | } |
200 | 200 | // By Class |
201 | - elseif (! empty($selector['class'])) { |
|
201 | + elseif (!empty($selector['class'])) { |
|
202 | 202 | $path = empty($selector['tag']) |
203 | 203 | ? "//*[@class=\"{$selector['class']}\"]" |
204 | 204 | : "//{$selector['tag']}[@class=\"{$selector['class']}\"]"; |
205 | 205 | } |
206 | 206 | // By tag only |
207 | - elseif (! empty($selector['tag'])) { |
|
207 | + elseif (!empty($selector['tag'])) { |
|
208 | 208 | $path = "//{$selector['tag']}"; |
209 | 209 | } |
210 | 210 | |
211 | - if (! empty($selector['attr'])) { |
|
211 | + if (!empty($selector['attr'])) { |
|
212 | 212 | foreach ($selector['attr'] as $key => $value) { |
213 | 213 | $path .= "[@{$key}=\"{$value}\"]"; |
214 | 214 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // $paths might contain a number of different |
218 | 218 | // ready to go xpath portions to tack on. |
219 | - if (! empty($paths) && is_array($paths)) { |
|
219 | + if (!empty($paths) && is_array($paths)) { |
|
220 | 220 | foreach ($paths as $extra) { |
221 | 221 | $path .= $extra; |
222 | 222 | } |
@@ -182,8 +182,8 @@ |
||
182 | 182 | */ |
183 | 183 | protected function runSeeds() |
184 | 184 | { |
185 | - if (! empty($this->seed)) { |
|
186 | - if (! empty($this->basePath)) { |
|
185 | + if (!empty($this->seed)) { |
|
186 | + if (!empty($this->basePath)) { |
|
187 | 187 | $this->seeder->setPath(rtrim($this->basePath, '/') . '/Seeds'); |
188 | 188 | } |
189 | 189 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $file = null; |
37 | 37 | |
38 | 38 | foreach ($trace as $row) { |
39 | - if (! in_array($row['function'], ['log', 'log_message'], true)) { |
|
39 | + if (!in_array($row['function'], ['log', 'log_message'], true)) { |
|
40 | 40 | $file = basename($row['file'] ?? ''); |
41 | 41 | break; |
42 | 42 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | // Empty bodies are not considered valid, unless in redirects |
135 | - return ! ($status < 300 && empty($this->response->getBody())); |
|
135 | + return !($status < 300 && empty($this->response->getBody())); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function getRedirectUrl(): ?string |
226 | 226 | { |
227 | - if (! $this->isRedirect()) { |
|
227 | + if (!$this->isRedirect()) { |
|
228 | 228 | return null; |
229 | 229 | } |
230 | 230 |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | $paths = new Paths(); |
42 | 42 | |
43 | 43 | // Define necessary framework path constants |
44 | -defined('APPPATH') || define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); |
|
45 | -defined('WRITEPATH') || define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); |
|
46 | -defined('SYSTEMPATH') || define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/')) . DIRECTORY_SEPARATOR); |
|
47 | -defined('ROOTPATH') || define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR); |
|
48 | -defined('CIPATH') || define('CIPATH', realpath(SYSTEMPATH . '../') . DIRECTORY_SEPARATOR); |
|
49 | -defined('FCPATH') || define('FCPATH', realpath(PUBLICPATH) . DIRECTORY_SEPARATOR); |
|
50 | -defined('TESTPATH') || define('TESTPATH', realpath(HOMEPATH . 'tests/') . DIRECTORY_SEPARATOR); |
|
51 | -defined('SUPPORTPATH') || define('SUPPORTPATH', realpath(TESTPATH . '_support/') . DIRECTORY_SEPARATOR); |
|
44 | +defined('APPPATH') || define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); |
|
45 | +defined('WRITEPATH') || define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); |
|
46 | +defined('SYSTEMPATH') || define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/')) . DIRECTORY_SEPARATOR); |
|
47 | +defined('ROOTPATH') || define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR); |
|
48 | +defined('CIPATH') || define('CIPATH', realpath(SYSTEMPATH . '../') . DIRECTORY_SEPARATOR); |
|
49 | +defined('FCPATH') || define('FCPATH', realpath(PUBLICPATH) . DIRECTORY_SEPARATOR); |
|
50 | +defined('TESTPATH') || define('TESTPATH', realpath(HOMEPATH . 'tests/') . DIRECTORY_SEPARATOR); |
|
51 | +defined('SUPPORTPATH') || define('SUPPORTPATH', realpath(TESTPATH . '_support/') . DIRECTORY_SEPARATOR); |
|
52 | 52 | defined('COMPOSER_PATH') || define('COMPOSER_PATH', realpath(HOMEPATH . 'vendor/autoload.php')); |
53 | -defined('VENDORPATH') || define('VENDORPATH', realpath(HOMEPATH . 'vendor') . DIRECTORY_SEPARATOR); |
|
53 | +defined('VENDORPATH') || define('VENDORPATH', realpath(HOMEPATH . 'vendor') . DIRECTORY_SEPARATOR); |
|
54 | 54 | |
55 | 55 | // Load Common.php from App then System |
56 | 56 | if (file_exists(APPPATH . 'Common.php')) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | require_once SYSTEMPATH . 'Common.php'; |
61 | 61 | |
62 | 62 | // Set environment values that would otherwise stop the framework from functioning during tests. |
63 | -if (! isset($_SERVER['app.baseURL'])) { |
|
63 | +if (!isset($_SERVER['app.baseURL'])) { |
|
64 | 64 | $_SERVER['app.baseURL'] = 'http://example.com/'; |
65 | 65 | } |
66 | 66 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | require_once APPPATH . 'Config/Services.php'; |
78 | 78 | |
79 | 79 | // Use Config\Services as CodeIgniter\Services |
80 | -if (! class_exists('CodeIgniter\Services', false)) { |
|
80 | +if (!class_exists('CodeIgniter\Services', false)) { |
|
81 | 81 | class_alias('Config\Services', 'CodeIgniter\Services'); |
82 | 82 | } |
83 | 83 |