Passed
Push — main ( 7d3811...971eef )
by Chema
01:28
created

PropertyChangeTracker::isChanged()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\Bootstrap;
6
7
final class PropertyChangeTracker
8
{
9
    /** @var array<string,bool> */
10
    private array $changedProperties = [];
11
12
    public function markAsChanged(string $propertyName): void
13
    {
14
        $this->changedProperties[$propertyName] = true;
15
    }
16
17
    public function markAsUnchanged(string $propertyName): void
18
    {
19
        $this->changedProperties[$propertyName] = false;
20
    }
21
22
    public function isChanged(string $propertyName): bool
23
    {
24
        return $this->changedProperties[$propertyName] ?? false;
25
    }
26
27
    /**
28
     * @return array<string,bool>
29
     */
30
    public function getAll(): array
31
    {
32
        return $this->changedProperties;
33
    }
34
}
35