Passed
Push — refactor/setup-gacela-2 ( 32146e )
by Chema
05:11
created

PropertyChangeTracker   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 26
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 3 1
A isChanged() 0 3 1
A markAsChanged() 0 3 1
A markAsUnchanged() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\Bootstrap\Setup;
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