@@ -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 |
@@ -50,6 +50,6 @@ |
||
50 | 50 | */ |
51 | 51 | public function columnWidth() |
52 | 52 | { |
53 | - return (string)ceil(12/$this->numColumns); |
|
53 | + return (string) ceil(12 / $this->numColumns); |
|
54 | 54 | } |
55 | 55 | } |
@@ -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()])) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->logger->warning( |
81 | 81 | 'AttachmentAwareTrait::attachments() parameters are deprecated. '. |
82 | 82 | 'An array of parameters should be used.', |
83 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
83 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 | $options = [ |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $loader->setDynamicTypeField('type'); |
187 | 187 | |
188 | 188 | if ($widget instanceof AttachmentWidget) { |
189 | - $callable = function (&$att) use ($widget, $before) { |
|
189 | + $callable = function(&$att) use ($widget, $before) { |
|
190 | 190 | if ($this instanceof AttachableInterface) { |
191 | 191 | $att->setContainerObj($this); |
192 | 192 | } |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | // } |
225 | 225 | |
226 | 226 | if ($before !== null) { |
227 | - call_user_func_array($before, [ &$att ]); |
|
227 | + call_user_func_array($before, [&$att]); |
|
228 | 228 | } |
229 | 229 | }; |
230 | 230 | } else { |
231 | - $callable = function (&$att) use ($before) { |
|
231 | + $callable = function(&$att) use ($before) { |
|
232 | 232 | if ($this instanceof AttachableInterface) { |
233 | 233 | $att->setContainerObj($this); |
234 | 234 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | if ($before !== null) { |
245 | - call_user_func_array($before, [ &$att ]); |
|
245 | + call_user_func_array($before, [&$att]); |
|
246 | 246 | } |
247 | 247 | }; |
248 | 248 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $this->logger->warning( |
317 | 317 | 'AttachmentAwareTrait::removeJoins() is deprecated. '. |
318 | 318 | 'Use AttachmentAwareTrait::removeAttachmentJoins() instead.', |
319 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
319 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
320 | 320 | ); |
321 | 321 | |
322 | 322 | return $this->removeAttachmentJoins(); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $defaults = $this->getDefaultAttachmentOptions(); |
445 | 445 | |
446 | 446 | $options = array_intersect_key($options, $defaults); |
447 | - $options = array_filter($options, [ $this, 'filterAttachmentOption' ], ARRAY_FILTER_USE_BOTH); |
|
447 | + $options = array_filter($options, [$this, 'filterAttachmentOption'], ARRAY_FILTER_USE_BOTH); |
|
448 | 448 | $options = array_replace($defaults, $options); |
449 | 449 | |
450 | 450 | return $options; |
@@ -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( |