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

EntityNotFoundException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromClassNameAndIdentifier() 0 10 3
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