@@ 57-66 (lines=10) @@ | ||
54 | /** |
|
55 | * @param array $data |
|
56 | */ |
|
57 | public function setData(array $data) |
|
58 | { |
|
59 | foreach ($data as $key => $value) { |
|
60 | if (!property_exists($this, $key)) { |
|
61 | continue; |
|
62 | } |
|
63 | ||
64 | $this->{$key} = $value; |
|
65 | } |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * @return array |
@@ 26-35 (lines=10) @@ | ||
23 | * |
|
24 | * @return void |
|
25 | */ |
|
26 | public function fromArray(array $data) |
|
27 | { |
|
28 | foreach ($data as $key => $value) { |
|
29 | if (!property_exists($this, $key)) { |
|
30 | continue; |
|
31 | } |
|
32 | ||
33 | $this->{$key} = $value; |
|
34 | } |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * Returns all properties as array. |