Completed
Pull Request — master (#835)
by Paweł
11:45
created

AssetLocationResolver::getMediaBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Content Bundle.
5
 *
6
 * Copyright 2019 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 2019 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\CoreBundle\Resolver;
16
17
use SWP\Bundle\ContentBundle\Resolver\AssetLocationResolver as BaseAssetLocationResolver;
18
use SWP\Bundle\CoreBundle\Model\TenantInterface;
19
use SWP\Component\MultiTenancy\Context\TenantContextInterface;
20
21 View Code Duplication
class AssetLocationResolver extends BaseAssetLocationResolver
22
{
23
    protected $tenantContext;
24
25
    public function setTenantContext(TenantContextInterface $tenantContext): void
26
    {
27
        $this->tenantContext = $tenantContext;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getMediaBasePath(): string
34
    {
35
        /** @var TenantInterface $tenant */
36
        $tenant = $this->tenantContext->getTenant();
37
38
        return sprintf('swp/%s/media', $tenant->getOrganization()->getCode());
39
    }
40
}
41