MultiTenancyExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getGlobals() 0 6 1
A getName() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher MultiTenancy Component.
5
 *
6
 * Copyright 2016 Sourcefabric z.u. 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 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\MultiTenancyBundle\Twig;
16
17
use SWP\Component\MultiTenancy\Context\TenantContextInterface;
18
use Twig\Extension\AbstractExtension;
19
use Twig\Extension\GlobalsInterface;
20
21
class MultiTenancyExtension extends AbstractExtension implements GlobalsInterface
22
{
23
    /**
24
     * @var TenantContextInterface
25
     */
26
    protected $tenantContext;
27
28
    /**
29
     * @param TenantContextInterface $tenantContext
30
     */
31
    public function __construct(TenantContextInterface $tenantContext)
32
    {
33
        $this->tenantContext = $tenantContext;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function getGlobals()
40
    {
41
        return [
42
            'tenant' => $this->tenantContext->getTenant(),
43
        ];
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getName()
50
    {
51
        return 'swp_multi_tenancy';
52
    }
53
}
54