Completed
Push — master ( 15ea05...a6b9a5 )
by James
14s
created

NotAPsrContainer::fromAnythingButAPsrContainer()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
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 4
            $filename,
18 4
            is_object($notAContainer) ? get_class($notAContainer) : gettype($notAContainer)
19
        ));
20
    }
21
}
22