Failed Conditions
Push — master ( 2ccf23...d791f7 )
by Michael
10:40
created

fromClassNameAndIdentifier()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 2
nop 2
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM;
6
7
/**
8
 * Exception thrown when a Proxy fails to retrieve an Entity result.
9
 */
10
class EntityNotFoundException extends ORMException
11
{
12
    /**
13
     * Static constructor.
14
     *
15
     * @param string   $className
16
     * @param string[] $id
17
     *
18
     * @return self
19
     */
20 3
    public static function fromClassNameAndIdentifier($className, array $id)
21
    {
22 3
        $ids = [];
23
24 3
        foreach ($id as $key => $value) {
25 3
            $ids[] = $key . '(' . $value . ')';
26
        }
27
28 3
        return new self(
29 3
            'Entity of type \'' . $className . '\'' . ($ids ? ' for IDs ' . implode(', ', $ids) : '') . ' was not found'
0 ignored issues
show
introduced by
The condition $ids can never be true.
Loading history...
30
        );
31
    }
32
}
33