blob: fb272b1101d370b69e9942fdaa872f56f0cd0019 (
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
31
32
33
34
|
<?php
namespace Wcms;
class Dbitem
{
public function hydrate($datas)
{
foreach ($datas as $key => $value) {
$method = 'set' . $key;
if (method_exists($this, $method)) {
$this->$method($value);
}
}
}
public function dry()
{
$array = [];
foreach (get_object_vars($this) as $var => $value) {
if (in_array($var, $this::VAR_DATE)) {
$array[$var] = $this->$var('string');
} else {
$array[$var] = $this->$var();
}
}
return $array;
}
}
?>
|