Completed
Push — 2.1 ( 0d6728...0539a2 )
by Rafał
09:25
created

AssetLocationResolver::getAwsUrl()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Content Bundle.
5
 *
6
 * Copyright 2020 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2020 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\ContentBundle\Resolver;
16
17
use SWP\Bundle\ContentBundle\Asset\AssetUrlGeneratorInterface;
18
use SWP\Bundle\ContentBundle\Model\FileInterface;
19
20
class AssetLocationResolver implements AssetLocationResolverInterface
21
{
22
    private $assetUrlGenerator;
23
24
    public function __construct(AssetUrlGeneratorInterface $assetUrlGenerator)
25
    {
26
        $this->assetUrlGenerator = $assetUrlGenerator;
27
    }
28
29
    public function getAssetUrl(FileInterface $file): string
30
    {
31
        $basePath = $this->getMediaBasePath();
32
33
        return $this->assetUrlGenerator->generateUrl($file, $basePath);
34
    }
35
36
    public function getMediaBasePath(): string
37
    {
38
        return AssetLocationResolverInterface::ASSET_BASE_PATH;
39
    }
40
}
41