@@ -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 | } |
@@ -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 | |
@@ -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 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->logger->warning( |
| 71 | 71 | 'AttachmentAwareTrait::getAttachments() parameters are deprecated. '. |
| 72 | 72 | 'An array of parameters should be used.', |
| 73 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
| 73 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
| 74 | 74 | ); |
| 75 | 75 | } |
| 76 | 76 | $options = [ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $loader->setModel($attProto); |
| 169 | 169 | $loader->setDynamicTypeField('type'); |
| 170 | 170 | |
| 171 | - $callable = function (&$att) use ($before) { |
|
| 171 | + $callable = function(&$att) use ($before) { |
|
| 172 | 172 | if ($this instanceof AttachableInterface) { |
| 173 | 173 | $att->setContainerObj($this); |
| 174 | 174 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if ($before !== null) { |
| 185 | - call_user_func_array($before, [ &$att ]); |
|
| 185 | + call_user_func_array($before, [&$att]); |
|
| 186 | 186 | } |
| 187 | 187 | }; |
| 188 | 188 | $collection = $loader->loadFromQuery($query, $after, $callable->bindTo($this)); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $this->logger->warning( |
| 255 | 255 | 'AttachmentAwareTrait::removeJoins() is deprecated. '. |
| 256 | 256 | 'Use AttachmentAwareTrait::removeAttachmentJoins() instead.', |
| 257 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
| 257 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | return $this->removeAttachmentJoins(); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $defaults = $this->getDefaultAttachmentOptions(); |
| 375 | 375 | |
| 376 | 376 | $options = array_intersect_key($options, $defaults); |
| 377 | - $options = array_filter($options, [ $this, 'filterAttachmentOption' ], ARRAY_FILTER_USE_BOTH); |
|
| 377 | + $options = array_filter($options, [$this, 'filterAttachmentOption'], ARRAY_FILTER_USE_BOTH); |
|
| 378 | 378 | $options = array_replace($defaults, $options); |
| 379 | 379 | |
| 380 | 380 | return $options; |
@@ -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()])) { |