Test Failed
Push — master ( 34c614...ede9b5 )
by Dawid
05:49
created

IdentityMapException::forNonExistingEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Exception;
4
5
use Igni\Storage\Entity;
6
7
class IdentityMapException extends StorageException
8
{
9
    public static function forEntityWithoutIdentity(Entity $entity): IdentityMapException
10
    {
11
        $class = get_class($entity);
12
        return new self("${class} has no identity, thus it cannot be attached to IdentityMap.");
13
    }
14
15
    public static function forNonExistingEntity($id): IdentityMapException
16
    {
17
        return new self("Object with {$id} was not found in IdentityMap.");
18
    }
19
}
20