@@ -71,7 +71,7 @@ |
||
| 71 | 71 | |
| 72 | 72 | private function getRelated(PackageInterface $package): RelatedArticleList |
| 73 | 73 | { |
| 74 | - $relatedItemsGroups = $package->getGroups()->filter(static function ($group) { |
|
| 74 | + $relatedItemsGroups = $package->getGroups()->filter(static function($group) { |
|
| 75 | 75 | return GroupInterface::TYPE_RELATED === $group->getType(); |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $items = $this->filterTextItems($package->getItems()); |
| 90 | 90 | |
| 91 | 91 | $map = $items->map( |
| 92 | - static function (ItemInterface $item) { |
|
| 92 | + static function(ItemInterface $item) { |
|
| 93 | 93 | return ' '.$item->getDescription(); |
| 94 | 94 | } |
| 95 | 95 | ); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $items = $this->filterTextItems($package->getItems()); |
| 106 | 106 | |
| 107 | - $authors = array_filter(array_values(array_map(static function (ItemInterface $item) { |
|
| 107 | + $authors = array_filter(array_values(array_map(static function(ItemInterface $item) { |
|
| 108 | 108 | $metadata = $item->getMetadata(); |
| 109 | 109 | |
| 110 | 110 | return $metadata['byline']; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | private function filterTextItems(Collection $items): Collection |
| 121 | 121 | { |
| 122 | 122 | return $items->filter( |
| 123 | - function (ItemInterface $item) { |
|
| 123 | + function(ItemInterface $item) { |
|
| 124 | 124 | $this->ensureTypeIsAllowed($item->getType()); |
| 125 | 125 | |
| 126 | 126 | return ItemInterface::TYPE_TEXT === $item->getType(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | private function populateBody(PackageInterface $package): string |
| 132 | 132 | { |
| 133 | - return $package->getBody().' '.implode('', array_map(function (ItemInterface $item) { |
|
| 133 | + return $package->getBody().' '.implode('', array_map(function(ItemInterface $item) { |
|
| 134 | 134 | $this->ensureTypeIsAllowed($item->getType()); |
| 135 | 135 | |
| 136 | 136 | return $item->getBody(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $items = $package->getItems()->filter( |
| 45 | - static function ($entry) use ($guids) { |
|
| 45 | + static function($entry) use ($guids) { |
|
| 46 | 46 | return !in_array($entry->getGuid(), $guids, true); |
| 47 | 47 | } |
| 48 | 48 | ); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if (null !== ($packageItems = $packageItem->getItems()) && 0 !== $packageItems->count()) { |
| 60 | 60 | $packageItems = $packageItem->getItems()->filter( |
| 61 | - static function ($entry) use ($guids) { |
|
| 61 | + static function($entry) use ($guids) { |
|
| 62 | 62 | return !in_array($entry->getGuid(), $guids, true); |
| 63 | 63 | } |
| 64 | 64 | ); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $groups->filter(static function ($group) { |
|
| 53 | + $groups->filter(static function($group) { |
|
| 54 | 54 | /* @var GroupInterface $group */ |
| 55 | 55 | return GroupInterface::TYPE_RELATED !== $group->getType(); |
| 56 | 56 | }); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | private function retryDecider(): callable |
| 66 | 66 | { |
| 67 | - return function ( |
|
| 67 | + return function( |
|
| 68 | 68 | $retries, |
| 69 | 69 | Request $request, |
| 70 | 70 | Response $response = null, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | private function retryDelay(): callable |
| 100 | 100 | { |
| 101 | - return static function ($numberOfRetries): int { |
|
| 101 | + return static function($numberOfRetries): int { |
|
| 102 | 102 | return 1000 * $numberOfRetries; |
| 103 | 103 | }; |
| 104 | 104 | } |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | private function findOriginalRendition(ItemInterface $item): RenditionInterface |
| 153 | 153 | { |
| 154 | 154 | return $item->getRenditions()->filter( |
| 155 | - static function (RenditionInterface $rendition) { |
|
| 155 | + static function(RenditionInterface $rendition) { |
|
| 156 | 156 | return 'original' === $rendition->getName(); |
| 157 | 157 | } |
| 158 | 158 | )->first(); |
@@ -47,8 +47,7 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $this->data = [ |
| 49 | 49 | 'currentPage' => $this->context->getCurrentPage() instanceof MetaInterface ? |
| 50 | - $this->getRouteData($this->context->getCurrentPage()->getValues()) : |
|
| 51 | - [], |
|
| 50 | + $this->getRouteData($this->context->getCurrentPage()->getValues()) : [], |
|
| 52 | 51 | 'registeredMeta' => $this->context->getRegisteredMeta(), |
| 53 | 52 | ]; |
| 54 | 53 | } |
@@ -198,6 +198,9 @@ |
||
| 198 | 198 | ]); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | + /** |
|
| 202 | + * @param null|string $token |
|
| 203 | + */ |
|
| 201 | 204 | private function generateOrGetApiKey(UserInterface $user, $token) |
| 202 | 205 | { |
| 203 | 206 | $apiKey = null; |
@@ -93,6 +93,9 @@ |
||
| 93 | 93 | return new SingleResourceResponse($list); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | + /** |
|
| 97 | + * @param string $id |
|
| 98 | + */ |
|
| 96 | 99 | private function findArticleOr404($id) |
| 97 | 100 | { |
| 98 | 101 | if (null === $article = $this->get('swp.repository.article')->findOneById($id)) { |