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

BinaryContentController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getImageVariation() 0 10 1
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