Completed
Push — master ( 511642...adfacc )
by Tobias
18:01 queued 08:01
created

AppKernel::getLogDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use Symfony\Component\HttpKernel\Kernel;
4
use Symfony\Component\Config\Loader\LoaderInterface;
5
6
class AppKernel extends Kernel
7
{
8
    private $projectDir;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
9
10
    public function registerBundles()
11
    {
12
        $bundles = [
13
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
14
            new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
15
            new \Symfony\Bundle\TwigBundle\TwigBundle(),
16
            new \Symfony\Bundle\WebServerBundle\WebServerBundle(),
17
            new \Translation\Bundle\TranslationBundle(),
18
            new \AppBundle\AppBundle(),
19
20
            new \Translation\PlatformAdapter\Loco\Bridge\Symfony\TranslationAdapterLocoBundle(),
21
            new \Translation\PlatformAdapter\Flysystem\Bridge\Symfony\TranslationAdapterFlysystemBundle(),
22
            //new \Translation\PlatformAdapter\PhraseApp\Bridge\Symfony\TranslationAdapterPhraseAppBundle(),
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
        ];
24
25
        return $bundles;
26
    }
27
28
    public function getRootDir()
29
    {
30
        return __DIR__;
31
    }
32
33
    public function getCacheDir()
34
    {
35
        return sys_get_temp_dir().'/php-translation/var/cache/'.$this->getEnvironment();
36
    }
37
38
    public function getLogDir()
39
    {
40
        return sys_get_temp_dir().'/php-translation/var/logs';
41
    }
42
43
    public function registerContainerConfiguration(LoaderInterface $loader)
44
    {
45
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
46
        $config = getcwd().'/translation.yml';
47
        if (file_exists($config)) {
48
            $loader->load($config);
49
        }
50
    }
51
52
    /**
53
     * Gets the application root dir (path of the project's LICENSE file).
54
     *
55
     * @return string The project root dir
56
     */
57
    public function getProjectDir()
58
    {
59
        if (null === $this->projectDir) {
60
            $r = new \ReflectionObject($this);
61
            $dir = $rootDir = dirname($r->getFileName());
0 ignored issues
show
Unused Code introduced by
$rootDir is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
62
            while (!file_exists($dir.'/LICENSE')) {
63
                if ($dir === dirname($dir)) {
64
                    return $this->projectDir = parent::getProjectDir();
65
                }
66
                $dir = dirname($dir);
67
            }
68
            $this->projectDir = $dir;
69
        }
70
71
        return $this->projectDir;
72
    }
73
}
74