diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-10-26 21:07:43 +0100 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-10-26 21:07:43 +0100 |
| commit | ae205d810b62dce5e3e11aef07358c11ded48c77 (patch) | |
| tree | 0196ae98aefb93b719d6b21cc065e22c1ecf992b /src/DTS/Old.php | |
| parent | d4122f116c937e0ec509d8cefe540146ec27a0cd (diff) | |
Implement old
Diffstat (limited to 'src/DTS/Old.php')
| -rw-r--r-- | src/DTS/Old.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/DTS/Old.php b/src/DTS/Old.php new file mode 100644 index 0000000..8545f8d --- /dev/null +++ b/src/DTS/Old.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +namespace DTS; + +class Old +{ + const FIELDS = [ + 'url', + 'title', + 'tag', + ]; + + private array $old = []; + + function __construct(array $request = []) + { + foreach(self::FIELDS as $field) { + if (array_key_exists($field, $request)) { + $this->old[$field] = $request[$field]; + } + } + } + + public function get(string $key, mixed $default = null): mixed + { + return $this->old[$key] ?? $default; + } +} |
