@@ -215,7 +215,7 @@ |
||
215 | 215 | /** |
216 | 216 | * Determine the number of attachments. |
217 | 217 | * |
218 | - * @return boolean |
|
218 | + * @return integer |
|
219 | 219 | */ |
220 | 220 | public function hasAttachments() |
221 | 221 | { |
@@ -2,7 +2,6 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Charcoal\Admin\Widget; |
4 | 4 | |
5 | -use ArrayIterator; |
|
6 | 5 | use RuntimeException; |
7 | 6 | use InvalidArgumentException; |
8 | 7 | |
@@ -10,7 +9,6 @@ discard block |
||
10 | 9 | use Pimple\Container; |
11 | 10 | |
12 | 11 | // From Mustache |
13 | -use Mustache_LambdaHelper as LambdaHelper; |
|
14 | 12 | |
15 | 13 | // From 'charcoal-config' |
16 | 14 | use Charcoal\Config\ConfigurableInterface; |
@@ -19,7 +17,6 @@ discard block |
||
19 | 17 | use Charcoal\Factory\FactoryInterface; |
20 | 18 | |
21 | 19 | // From 'charcoal-core' |
22 | -use Charcoal\Loader\CollectionLoader; |
|
23 | 20 | use Charcoal\Model\ModelInterface; |
24 | 21 | |
25 | 22 | // From 'charcoal-translator' |
@@ -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( |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * Alias of {@see Attachment::file()}. |
15 | 15 | * |
16 | - * @return string|null |
|
16 | + * @return \Psr\Http\Message\UriInterface|null |
|
17 | 17 | */ |
18 | 18 | public function src() |
19 | 19 | { |
@@ -12,7 +12,7 @@ |
||
12 | 12 | /** |
13 | 13 | * Alias of {@see Attachment::thumbnail()} and {@see Attachment::file()}. |
14 | 14 | * |
15 | - * @return string|null |
|
15 | + * @return \Psr\Http\Message\UriInterface|null |
|
16 | 16 | */ |
17 | 17 | public function src() |
18 | 18 | { |
@@ -471,7 +471,7 @@ |
||
471 | 471 | /** |
472 | 472 | * Retrieve the relationship's group ID. |
473 | 473 | * |
474 | - * @return mixed |
|
474 | + * @return string |
|
475 | 475 | */ |
476 | 476 | public function group() |
477 | 477 | { |
@@ -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 | } |
@@ -293,7 +293,7 @@ |
||
293 | 293 | * Set the attachment widget. |
294 | 294 | * |
295 | 295 | * @param AttachmentWidget $widget The widget displaying attachments. |
296 | - * @return string |
|
296 | + * @return AttachmentAwareTrait |
|
297 | 297 | */ |
298 | 298 | protected function setAttachmentWidget(AttachmentWidget $widget) |
299 | 299 | { |
@@ -13,8 +13,6 @@ |
||
13 | 13 | // From 'charcoal-attachment' |
14 | 14 | use Charcoal\Attachment\Interfaces\AttachableInterface; |
15 | 15 | use Charcoal\Attachment\Interfaces\AttachmentAwareInterface; |
16 | -use Charcoal\Attachment\Interfaces\AttachmentContainerInterface; |
|
17 | - |
|
18 | 16 | use Charcoal\Attachment\Object\Join; |
19 | 17 | use Charcoal\Attachment\Object\Attachment; |
20 | 18 |
@@ -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; |
@@ -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)) { |
@@ -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 | } |