55 lines
1 KiB
PHP
55 lines
1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Application\Security\Models\ValueObjects\Entities;
|
||
|
|
|
||
|
|
use Shared\DDD\Model\Equatable;
|
||
|
|
|
||
|
|
final readonly class SecurityAuditLogDetails implements Equatable
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @param array<string, string> $values
|
||
|
|
*/
|
||
|
|
public function __construct(
|
||
|
|
private array $values = [],
|
||
|
|
) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public function getValues(): array
|
||
|
|
{
|
||
|
|
$output = [];
|
||
|
|
|
||
|
|
foreach ($this->values as $key => $value) {
|
||
|
|
$output[(string) $key] = (string) $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
return $output;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function empty(): self
|
||
|
|
{
|
||
|
|
return new self([]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function isEmpty(): bool
|
||
|
|
{
|
||
|
|
return $this->values === [];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function get(string $key): ?string
|
||
|
|
{
|
||
|
|
return $this->values[$key] ?? null;
|
||
|
|
}
|
||
|
|
|
||
|
|
#[\Override]
|
||
|
|
public function equals(mixed $other): bool
|
||
|
|
{
|
||
|
|
return $other instanceof self
|
||
|
|
&& $this->values === $other->values;
|
||
|
|
}
|
||
|
|
}
|