Completed
Push — master ( 2ae6ae...28d798 )
by Paweł
22s queued 12s
created

SeoAssetLocationResolver::setTenantContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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 SeoAssetLocationResolver 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/seo_images', $tenant->getOrganization()->getCode());
39
    }
40
}
41