@@ -69,7 +69,7 @@ |
||
| 69 | 69 | $pivot = $this->modelFactory()->create(Join::class); |
| 70 | 70 | |
| 71 | 71 | if (is_string($data) && strpos($data, '_') > 1) { |
| 72 | - $data = array_combine([ 'obj_type', 'obj_id' ], explode('_', $data, 1)); |
|
| 72 | + $data = array_combine(['obj_type', 'obj_id'], explode('_', $data, 1)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (is_scalar($data)) { |
@@ -402,7 +402,7 @@ |
||
| 402 | 402 | ); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - $this->position = (int)$position; |
|
| 405 | + $this->position = (int) $position; |
|
| 406 | 406 | |
| 407 | 407 | return $this; |
| 408 | 408 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ]); |
| 257 | 257 | $rows = $source->dbQuery( |
| 258 | 258 | strtr($sql, $binds), |
| 259 | - [ 'objType' => $row['object_type'] ] |
|
| 259 | + ['objType' => $row['object_type']] |
|
| 260 | 260 | ); |
| 261 | 261 | |
| 262 | 262 | /** @todo Show found rows, confirm deletion of dead relationships */ |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $sql = 'SELECT p.* FROM `%pivotTable` AS p WHERE p.`%sourceType` = :objType;'; |
| 277 | 277 | $rows = $source->dbQuery( |
| 278 | 278 | strtr($sql, $defaultBinds), |
| 279 | - [ 'objType' => $model ] |
|
| 279 | + ['objType' => $model] |
|
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | 282 | /** @todo Explain missing model, confirm deletion of dead relationships */ |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | ]; |
| 395 | 395 | |
| 396 | 396 | if ($ask && $verb) { |
| 397 | - $dead = array_merge([ 'Deleted' => null, 'Failed' => null ], $dead); |
|
| 397 | + $dead = array_merge(['Deleted' => null, 'Failed' => null], $dead); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $cli = $this->climate(); |
| 618 | 618 | |
| 619 | 619 | if (is_string($this->action)) { |
| 620 | - $opts = [ 'y', 'n', 'r', 'q', '?' ]; |
|
| 620 | + $opts = ['y', 'n', 'r', 'q', '?']; |
|
| 621 | 621 | $help = [ |
| 622 | 622 | '[y]es — delete the attachment', |
| 623 | 623 | '[n]o — don’t delete the attachment', |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | '[q]uit — exit immediately (does not undo previous actions)', |
| 626 | 626 | ]; |
| 627 | 627 | } else { |
| 628 | - $opts = [ 'y', 'a', 'n', 's', 'q', '?' ]; |
|
| 628 | + $opts = ['y', 'a', 'n', 's', 'q', '?']; |
|
| 629 | 629 | $help = [ |
| 630 | 630 | '[y]es — delete this attachment', |
| 631 | 631 | '[a]ll — delete all attachments', |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | { |
| 687 | 687 | $cli = $this->climate(); |
| 688 | 688 | |
| 689 | - $opts = [ 'y', 'n', 'v', '?' ]; |
|
| 689 | + $opts = ['y', 'n', 'v', '?']; |
|
| 690 | 690 | $help = [ |
| 691 | 691 | '[y]es — continue to deletion phase', |
| 692 | 692 | '[n]o — cancel deletion phase', |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | |
| 90 | 90 | $count = count($attachments); |
| 91 | 91 | $i = 0; |
| 92 | - for (; $i<$count; $i++) { |
|
| 92 | + for (; $i < $count; $i++) { |
|
| 93 | 93 | $attachmentId = $attachments[$i]['attachment_id']; |
| 94 | 94 | $position = $attachments[$i]['position']; |
| 95 | 95 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | public function attachments(...$args) |
| 59 | 59 | { |
| 60 | 60 | $attachables = $this->attachableObjects(); |
| 61 | - $attachments = call_user_func_array([ $this, 'getAttachments' ], $args); |
|
| 61 | + $attachments = call_user_func_array([$this, 'getAttachments'], $args); |
|
| 62 | 62 | |
| 63 | 63 | foreach ($attachments as $attachment) { |
| 64 | 64 | if (isset($attachables[$attachment->objType()])) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | parent::__construct($data); |
| 198 | 198 | |
| 199 | - if (is_callable([ $this, 'defaultData' ])) { |
|
| 199 | + if (is_callable([$this, 'defaultData'])) { |
|
| 200 | 200 | $defaultData = $this->metadata()->defaultData(); |
| 201 | 201 | if ($defaultData) { |
| 202 | 202 | $this->setData($defaultData); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | public function heading() |
| 374 | 374 | { |
| 375 | - $heading = $this->render((string)$this->heading); |
|
| 375 | + $heading = $this->render((string) $this->heading); |
|
| 376 | 376 | |
| 377 | 377 | if (!$heading) { |
| 378 | 378 | $heading = $this->translator()->translation('{{ objType }} #{{ id }}', [ |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public function preview() |
| 416 | 416 | { |
| 417 | 417 | if ($this->preview) { |
| 418 | - return $this->render((string)$this->preview); |
|
| 418 | + return $this->render((string) $this->preview); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return ''; |
@@ -1008,19 +1008,19 @@ discard block |
||
| 1008 | 1008 | static $search; |
| 1009 | 1009 | |
| 1010 | 1010 | if ($search === null) { |
| 1011 | - $attr = [ 'href', 'link', 'url', 'src' ]; |
|
| 1012 | - $scheme = [ '../', './', '/', 'data', 'mailto', 'http' ]; |
|
| 1011 | + $attr = ['href', 'link', 'url', 'src']; |
|
| 1012 | + $scheme = ['../', './', '/', 'data', 'mailto', 'http']; |
|
| 1013 | 1013 | |
| 1014 | 1014 | $search = sprintf( |
| 1015 | 1015 | '(?<=%1$s=")(?!%2$s)(\S+)(?=")', |
| 1016 | - implode('="|', array_map('preg_quote', $attr, [ '~' ])), |
|
| 1017 | - implode('|', array_map('preg_quote', $scheme, [ '~' ])) |
|
| 1016 | + implode('="|', array_map('preg_quote', $attr, ['~'])), |
|
| 1017 | + implode('|', array_map('preg_quote', $scheme, ['~'])) |
|
| 1018 | 1018 | ); |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | $text = preg_replace_callback( |
| 1022 | 1022 | '~'.$search.'~i', |
| 1023 | - function ($matches) { |
|
| 1023 | + function($matches) { |
|
| 1024 | 1024 | return $this->createAbsoluteUrl($matches[1]); |
| 1025 | 1025 | }, |
| 1026 | 1026 | $text |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | protected function isRelativeUri($uri) |
| 1040 | 1040 | { |
| 1041 | 1041 | if ($uri && !parse_url($uri, PHP_URL_SCHEME)) { |
| 1042 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
| 1042 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
| 1043 | 1043 | return true; |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ]); |
| 211 | 211 | |
| 212 | 212 | foreach ($attachments as $attachment) { |
| 213 | - $this->setDynamicTemplate('widget_template', (string)$attachment->rawPreview()); |
|
| 213 | + $this->setDynamicTemplate('widget_template', (string) $attachment->rawPreview()); |
|
| 214 | 214 | |
| 215 | 215 | if (isset($attachableObjects[$attachment->objType()])) { |
| 216 | 216 | $attachment->attachmentType = $attachableObjects[$attachment->objType()]; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | ); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $num = (int)$num; |
|
| 477 | + $num = (int) $num; |
|
| 478 | 478 | |
| 479 | 479 | if ($num < 0) { |
| 480 | 480 | throw new InvalidArgumentException( |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | ); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - $page = (int)$page; |
|
| 505 | + $page = (int) $page; |
|
| 506 | 506 | |
| 507 | 507 | if ($page < 0) { |
| 508 | 508 | throw new InvalidArgumentException( |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function registerBaseUrl(Container $container) |
| 84 | 84 | { |
| 85 | - $container['base-url'] = function () { |
|
| 85 | + $container['base-url'] = function() { |
|
| 86 | 86 | return Uri::createFromString(''); |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | - $container['admin/base-url'] = function () { |
|
| 89 | + $container['admin/base-url'] = function() { |
|
| 90 | 90 | return Uri::createFromString('admin'); |
| 91 | 91 | }; |
| 92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function registerConfig(Container $container) |
| 101 | 101 | { |
| 102 | - $container['config'] = function () { |
|
| 102 | + $container['config'] = function() { |
|
| 103 | 103 | return new AppConfig([ |
| 104 | 104 | 'base_path' => realpath(__DIR__.'/../../..'), |
| 105 | 105 | 'apis' => [ |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $this->registerConfig($container); |
| 151 | 151 | |
| 152 | - $container['admin/config'] = function () { |
|
| 152 | + $container['admin/config'] = function() { |
|
| 153 | 153 | return new AdminConfig(); |
| 154 | 154 | }; |
| 155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function registerClimate(Container $container) |
| 162 | 162 | { |
| 163 | - $container['climate/system'] = function () { |
|
| 163 | + $container['climate/system'] = function() { |
|
| 164 | 164 | $system = Mockery::mock(Linux::class); |
| 165 | 165 | $system->shouldReceive('hasAnsiSupport')->andReturn(true); |
| 166 | 166 | $system->shouldReceive('width')->andReturn(80); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return $system; |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | - $container['climate/output'] = function () { |
|
| 171 | + $container['climate/output'] = function() { |
|
| 172 | 172 | $output = Mockery::mock(Output::class); |
| 173 | 173 | $output->shouldReceive('persist')->andReturn($output); |
| 174 | 174 | $output->shouldReceive('sameLine')->andReturn($output); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return $output; |
| 178 | 178 | }; |
| 179 | 179 | |
| 180 | - $container['climate/reader'] = function () { |
|
| 180 | + $container['climate/reader'] = function() { |
|
| 181 | 181 | $reader = Mockery::mock(Stdin::class); |
| 182 | 182 | $reader->shouldReceive('line')->andReturn('line'); |
| 183 | 183 | $reader->shouldReceive('char')->andReturn('char'); |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | return $reader; |
| 186 | 186 | }; |
| 187 | 187 | |
| 188 | - $container['climate/util'] = function (Container $container) { |
|
| 188 | + $container['climate/util'] = function(Container $container) { |
|
| 189 | 189 | return new UtilFactory($container['climate/system']); |
| 190 | 190 | }; |
| 191 | 191 | |
| 192 | - $container['climate'] = function (Container $container) { |
|
| 192 | + $container['climate'] = function(Container $container) { |
|
| 193 | 193 | $climate = new CLImate(); |
| 194 | 194 | |
| 195 | 195 | $climate->setOutput($container['climate/output']); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function registerDatabase(Container $container) |
| 208 | 208 | { |
| 209 | - $container['database'] = function () { |
|
| 209 | + $container['database'] = function() { |
|
| 210 | 210 | $pdo = new PDO('sqlite::memory:'); |
| 211 | 211 | $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 212 | 212 | return $pdo; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function registerLogger(Container $container) |
| 296 | 296 | { |
| 297 | - $container['logger'] = function () { |
|
| 297 | + $container['logger'] = function() { |
|
| 298 | 298 | return new NullLogger(); |
| 299 | 299 | }; |
| 300 | 300 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function registerCache(Container $container) |
| 307 | 307 | { |
| 308 | - $container['cache'] = function () { |
|
| 308 | + $container['cache'] = function() { |
|
| 309 | 309 | return new Pool(); |
| 310 | 310 | }; |
| 311 | 311 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function description() |
| 134 | 134 | { |
| 135 | - return $this->renderTemplate((string)parent::description()); |
|
| 135 | + return $this->renderTemplate((string) parent::description()); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function notes() |
| 142 | 142 | { |
| 143 | - return $this->renderTemplate((string)parent::notes()); |
|
| 143 | + return $this->renderTemplate((string) parent::notes()); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |