Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| AuditLog | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getReference | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRawData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Common\Other; |
| 3 | |
| 4 | use Apie\Core\Attributes\AlwaysDisabled; |
| 5 | use Apie\Core\Attributes\Context; |
| 6 | use Apie\Core\Attributes\FakeCount; |
| 7 | use Apie\Core\Attributes\Not; |
| 8 | use Apie\Core\Attributes\Requires; |
| 9 | use Apie\Core\Attributes\StaticCheck; |
| 10 | use Apie\Core\Attributes\StoreOptions; |
| 11 | use Apie\Core\Entities\EntityInterface; |
| 12 | use Apie\Core\ValueObjects\EntityReference; |
| 13 | use Apie\Core\ValueObjects\IdFriendlyEntityReference; |
| 14 | use Apie\Serializer\PropertySerializer\SerializedProperties; |
| 15 | |
| 16 | #[FakeCount(0)] |
| 17 | class AuditLog implements EntityInterface |
| 18 | { |
| 19 | private AuditLogIdentifier $id; |
| 20 | |
| 21 | #[StaticCheck(new AlwaysDisabled())] |
| 22 | public function __construct( |
| 23 | private readonly IdFriendlyEntityReference $reference, |
| 24 | #[Context()] |
| 25 | #[StoreOptions(alwaysMixedData: true)] |
| 26 | private readonly SerializedProperties $serializedProperties, |
| 27 | ) { |
| 28 | $this->id = new AuditLogIdentifier($reference, microtime(true)); |
| 29 | } |
| 30 | |
| 31 | public function getId(): AuditLogIdentifier |
| 32 | { |
| 33 | return $this->id; |
| 34 | } |
| 35 | |
| 36 | public function getReference(): IdFriendlyEntityReference |
| 37 | { |
| 38 | return $this->reference; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @return array<string, mixed> |
| 43 | */ |
| 44 | public function getRawData(): array |
| 45 | { |
| 46 | return $this->serializedProperties->jsonSerialize(); |
| 47 | } |
| 48 | |
| 49 | public function getData(): ?EntityInterface |
| 50 | { |
| 51 | // TODO |
| 52 | return null; |
| 53 | } |
| 54 | } |