EntityNotFoundException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 5
c 3
b 1
f 0
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10
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
use Doctrine\ORM\Exception\ORMException;
8
use RuntimeException;
9
use function implode;
10
11
/**
12
 * Exception thrown when a Proxy fails to retrieve an Entity result.
13
 */
14
class EntityNotFoundException extends RuntimeException implements ORMException
15
{
16
    /**
17
     * Static constructor.
18
     *
19
     * @param string  $className
20
     * @param mixed[] $id
21
     *
22
     * @return self
23
     */
24 3
    public static function fromClassNameAndIdentifier($className, array $id)
25
    {
26 3
        $ids = [];
27
28 3
        foreach ($id as $key => $value) {
29 3
            $ids[] = $key . '(' . $value . ')';
30
        }
31
32 3
        return new self(
33 3
            'Entity of type \'' . $className . '\'' . ($ids ? ' for IDs ' . implode(', ', $ids) : '') . ' was not found'
34
        );
35
    }
36
}
37