-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e095a6
commit 8bf6a3d
Showing
3 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace PhpRetention; | ||
|
||
use DateTimeImmutable; | ||
use JsonSerializable; | ||
use ReflectionClass; | ||
|
||
class Result implements JsonSerializable | ||
{ | ||
public function __construct( | ||
public readonly array $keepList, | ||
public readonly array $pruneList, | ||
public readonly int $startTime, | ||
public readonly int $endTime | ||
) | ||
{} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
$reflection = new ReflectionClass($this); | ||
$props = $reflection->getProperties(); | ||
$data = []; | ||
foreach ($props as $prop) { | ||
if ($prop->isPublic()) { | ||
$data[$prop->getName()] = $prop->getValue($this); | ||
} | ||
} | ||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters