NotAPsrContainer::fromAnythingButAPsrContainer()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 2
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Roave\BehatPsrContainer\Exception;
5
6
final class NotAPsrContainer extends \RuntimeException
7
{
8
    /**
9
     * @param string $filename
10
     * @param mixed $notAContainer
11
     * @return self
12
     */
13 4
    public static function fromAnythingButAPsrContainer(string $filename, $notAContainer) : self
14
    {
15 4
        return new self(sprintf(
16 4
            'File %s must return a PSR-11 container, actually returned %s',
17
            $filename,
18 4
            is_object($notAContainer) ? get_class($notAContainer) : gettype($notAContainer)
19
        ));
20
    }
21
}
22