Completed
Push — master ( 4a311e...f33b08 )
by WEBEWEB
01:26
created

KernelHelper::getProjectDir()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Helper;
13
14
use Symfony\Component\HttpKernel\KernelInterface;
15
16
class KernelHelper {
17
18
    /**
19
     * Get a project directory.
20
     *
21
     * @param KernelInterface $kernel The kernel.
22
     * @return string Returns the project directory.
23
     */
24
    public static function getProjectDir(KernelInterface $kernel) {
25
26
        $method = "getProjectDir";
27
        if (true === method_exists($kernel, $method)) {
28
            return $kernel->$method();
29
        } else {
30
            $method = "getRootDir";
31
        }
32
33
        return $kernel->$method() . "/..";
34
    }
35
}
36