Completed
Push — ezp-30882-thumbnail ( 1223cf...3134e5 )
by
unknown
15:29
created

StaticStrategy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getThumbnail() 0 6 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\Repository\Strategy\ContentThumbnail;
10
11
use eZ\Publish\API\Repository\Values\Content\Thumbnail;
12
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
13
use eZ\Publish\SPI\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
14
15
final class StaticStrategy implements ThumbnailStrategy
16
{
17
    /** @var string */
18
    private $staticThumbnail;
19
20
    public function __construct(string $staticThumbnail)
21
    {
22
        $this->staticThumbnail = $staticThumbnail;
23
    }
24
25
    public function getThumbnail(ContentType $contentType, array $fields): Thumbnail
26
    {
27
        return new Thumbnail([
28
            'resource' => $this->staticThumbnail,
29
        ]);
30
    }
31
}
32