ChangeSets   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addObjectChange() 0 3 1
A getObjectChangeSet() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\SkeletonMapper\UnitOfWork;
6
7
use function spl_object_hash;
8
9
class ChangeSets
10
{
11
    /** @var ChangeSet[] */
12
    private $changeSets = [];
13
14
    /**
15
     * @param object $object
16
     */
17 12
    public function addObjectChange($object, Change $change) : void
18
    {
19 12
        $this->getObjectChangeSet($object)->addChange($change);
20 12
    }
21
22
    /**
23
     * @param object $object
24
     */
25 12
    public function getObjectChangeSet($object) : ChangeSet
26
    {
27 12
        $oid = spl_object_hash($object);
28
29 12
        if (! isset($this->changeSets[$oid])) {
30 12
            $this->changeSets[$oid] = new ChangeSet($object);
31
        }
32
33 12
        return $this->changeSets[$oid];
34
    }
35
}
36