diff options
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; + } +} |
