Passed
Pull Request — master (#9)
by Pavel
06:48
created

Kernel   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 41
c 0
b 0
f 0
wmc 6
lcom 0
cbo 6
ccs 20
cts 20
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getCacheDir() 0 4 1
A getLogDir() 0 4 1
A registerBundles() 0 9 1
A getName() 0 4 1
A registerContainerConfiguration() 0 4 1
1
<?php
2
3
namespace Bankiru\Api\Rpc\Test;
4
5
use Bankiru\Api\Rpc\BankiruRpcServerBundle;
6
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
7
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
8
use Symfony\Bundle\SecurityBundle\SecurityBundle;
9
use Symfony\Component\Config\Loader\LoaderInterface;
10
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
11
12
final class Kernel extends BaseKernel
13
{
14 12
    public function __construct($environment, $debug)
15
    {
16 12
        @unlink($this->getCacheDir());
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
17 12
        @unlink($this->getLogDir());
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
18 12
        parent::__construct($environment, $debug);
19 12
    }
20
21 12
    public function getCacheDir()
22
    {
23 12
        return __DIR__ . '/../../build/' . $this->getName() . '/cache';
24
    }
25
26 12
    public function getLogDir()
27
    {
28 12
        return __DIR__ . '/../../build/' . $this->getName() . '/log';
29
    }
30
31
    /** {@inheritdoc} */
32 12
    public function registerBundles()
33
    {
34
        return [
35 12
            new SensioFrameworkExtraBundle(),
36 12
            new FrameworkBundle(),
37 12
            new BankiruRpcServerBundle(),
38 12
            new SecurityBundle(),
39 12
        ];
40
    }
41
42 12
    public function getName()
43
    {
44 12
        return 'rpc_test';
45
    }
46
47
    /** {@inheritdoc} */
48 1
    public function registerContainerConfiguration(LoaderInterface $loader)
49
    {
50 1
        $loader->load(__DIR__ . '/config/test.yml');
51 1
    }
52
}
53