summaryrefslogtreecommitdiff
path: root/src/DTS/Old.php
blob: 6e8cbee3a60a43f6ad6063b9a924a4a02a4b775f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

declare(strict_types=1);

namespace DTS;

class Old
{
    const FIELDS = [
        'task',
        'description',
        '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, $default = null)
    {
        return $this->old[$key] ?? $default;
    }
}