Completed
Pull Request — master (#1)
by Rafał
03:42
created

TenantContext::getTenant()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher MultiTenancy Component.
5
 *
6
 * Copyright 2015 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 2015 Sourcefabric z.ú.
12
 * @license http://www.superdesk.org/license
13
 */
14
namespace SWP\Component\MultiTenancy\Context;
15
16
use SWP\Component\MultiTenancy\Model\Tenant;
17
use SWP\Component\MultiTenancy\Model\TenantInterface;
18
19
/**
20
 * Class TenantContext.
21
 */
22
class TenantContext implements TenantContextInterface
23
{
24
    /**
25
     * @var TenantInterface
26
     */
27
    protected $tenant;
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getTenant()
33
    {
34
        if (null === $this->tenant) {
35
            return new Tenant();
36
        }
37
38
        return $this->tenant;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function setTenant(TenantInterface $tenant)
45
    {
46
        $this->tenant = $tenant;
47
    }
48
}
49