Completed
Pull Request — master (#6)
by Pavel
03:57
created

Kernel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Bankiru\Api\Rpc\Tests\Fixtures;
4
5
use Bankiru\Api\Rpc\RpcBundle;
6
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
7
use Symfony\Component\Config\Loader\LoaderInterface;
8
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
9
10
class Kernel extends BaseKernel
11
{
12 10
    public function __construct($environment, $debug)
13
    {
14 10
        @unlink($this->getCacheDir());
1 ignored issue
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...
15 10
        @unlink($this->getLogDir());
1 ignored issue
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...
16 10
        parent::__construct($environment, $debug);
17 10
    }
18
19 10
    public function getCacheDir()
20
    {
21 10
        return __DIR__ . '/../../../../../../build/cache/';
22
    }
23
24 10
    public function getLogDir()
25
    {
26 10
        return __DIR__ . '/../../../../../../build/log/';
27
    }
28
29
    /** {@inheritdoc} */
30 10
    public function registerBundles()
31
    {
32
        return [
33 10
            new FrameworkBundle(),
34 10
            new RpcBundle(),
35 10
        ];
36
    }
37
38
    /** {@inheritdoc} */
39 1
    public function registerContainerConfiguration(LoaderInterface $loader)
40
    {
41 1
        $loader->load(__DIR__ . '/config/test.yml');
42 1
    }
43
}
44