Completed
Push — ezp26297-rest_embedding_http_c... ( 123323 )
by
unknown
80:28 queued 54:58
created

BinaryContentController::getImageVariation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Publish\Core\REST\Server\HttpCache\Controller;
7
8
use eZ\Publish\API\Repository\ContentService;
9
use eZ\Publish\Core\REST\Server\Values\CachedValue;
10
11
class BinaryContentController extends AbstractController
12
{
13
    /**
14
     * @var \eZ\Publish\Core\REST\Server\Controller\BinaryContent
15
     */
16
    private $innerController;
17
18
    /**
19
     * @var \eZ\Publish\API\Repository\ContentService
20
     */
21
    private $contentService;
22
23
    public function __construct($innerController, ContentService $contentService)
24
    {
25
        $this->innerController = $innerController;
26
        $this->contentService = $contentService;
27
    }
28
29
    public function getImageVariation($imageId, $variationIdentifier)
30
    {
31
        $imageVariation = $this->innerController->getImageVariation($imageId, $variationIdentifier);
32
        list($contentId) = explode('-', $imageId);
33
34
        return new CachedValue(
35
            $imageVariation,
36
            $this->getCacheTagsForContentInfo($this->contentService->loadContentInfo($contentId))
37
        );
38
    }
39
}
40