AppKernel::getCacheDir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace test\Vivait\TenantBundle\app;
4
5
use Symfony\Component\Config\Loader\LoaderInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
use Vivait\TenantBundle\Kernel\TenantKernel;
8
use Vivait\TenantBundle\Locator\HostnameLocator;
9
use Vivait\TenantBundle\Model\Tenant;
10
use Vivait\TenantBundle\Provider\ConfigProvider;
11
12
class AppKernel extends TenantKernel
13
{
14
    /**
15
     * @return \Symfony\Component\HttpKernel\Bundle\Bundle[]
16
     */
17
    public function registerBundles()
18
    {
19
        return array(
20
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
21
            new \Vivait\TenantBundle\VivaitTenantBundle()
22
        );
23
    }
24
25
    /**
26
     * @return null
27
     */
28
    public function registerContainerConfiguration( LoaderInterface $loader )
29
    {
30
        $loader->load( __DIR__ . '/config/config_' . $this->getEnvironment() . '.yml' );
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getCacheDir()
37
    {
38
        return sys_get_temp_dir() . '/VivaitTenantBundle/cache';
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getLogDir()
45
    {
46
        return sys_get_temp_dir() . '/VivaitTenantBundle/logs';
47
    }
48
49
    /**
50
     * Provides an instance of a tenant provider
51
     *
52
     * @return Tenant[]
53
     */
54
    protected function getAllTenants()
55
    {
56
        $configProvider = new ConfigProvider( __DIR__ . '/config/' );
57
        return $configProvider->loadTenants();
58
    }
59
60
    /**
61
     * Provides the current tenant's key
62
     * @param Request $request
63
     * @return string The current tenant's key
64
     */
65
    protected function getCurrentTenantKey( Request $request )
66
    {
67
        return HostnameLocator::getTenantFromRequest( $request );
68
    }
69
}
70