Passed
Pull Request — master (#198)
by Kevin
02:44
created

ContainerBC::container()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 11
rs 10
cc 3
nc 3
nop 0
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Functional;
4
5
use Psr\Container\ContainerInterface;
6
7
/**
8
 * @author Kevin Bond <[email protected]>
9
 */
10
trait ContainerBC
11
{
12
    private static function container(): ContainerInterface
13
    {
14
        if (!\method_exists(static::class, 'getContainer')) {
15
            if (!static::$booted) {
16
                static::bootKernel();
17
            }
18
19
            return self::$container;
20
        }
21
22
        return self::getContainer();
23
    }
24
}
25