ContainerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createContainerFromIncludedFile() 0 11 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Roave\BehatPsrContainer;
5
6
use Psr\Container\ContainerInterface;
7
8
final class ContainerFactory
9
{
10
    /**
11
     * @param string $containerFile
12
     * @return ContainerInterface
13
     * @throws \RuntimeException
14
     */
15 2
    public static function createContainerFromIncludedFile(string $containerFile) : ContainerInterface
16
    {
17
        /** @noinspection PhpIncludeInspection */
18 2
        $container = require $containerFile;
19
20 2
        if (!$container instanceof ContainerInterface) {
21 1
            throw Exception\NotAPsrContainer::fromAnythingButAPsrContainer($containerFile, $container);
22
        }
23
24 1
        return $container;
25
    }
26
}
27