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

StaticStrategy::getThumbnail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
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