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

IdentityMapException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
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