aboutsummaryrefslogtreecommitdiff
path: root/app/class/Dbitem.php
blob: f8bc4b7f1e30c19e1f4d0429d0c91d730258b61e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Wcms;

use DateTime;
use DateTimeImmutable;

abstract class Dbitem extends Item
{

    public function dry(): array
    {
        $array = [];
        foreach (get_object_vars($this) as $var => $value) {
            if ($value instanceof DateTime || $value instanceof DateTimeImmutable) {
                $array[$var] = $this->$var('string');
            } else {
                $array[$var] = $this->$var();
            }
        }
        return $array;
    }
}