| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | abstract class AbstractDataRow implements DataRowInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * BaseEntity constructor. |
||
| 15 | * |
||
| 16 | * @todo rename datarow to entity |
||
| 17 | * |
||
| 18 | * @param array $row |
||
| 19 | */ |
||
| 20 | public function __construct(array $row = null) |
||
| 21 | { |
||
| 22 | if ($row) { |
||
| 23 | $this->getHydrator()->hydrate($row, $this); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Get Hydrator. |
||
| 29 | * |
||
| 30 | * @return Hydrator Hydrator |
||
| 31 | */ |
||
| 32 | protected function getHydrator() |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Extract objects to arrays. |
||
| 42 | * |
||
| 43 | * @return array |
||
| 44 | */ |
||
| 45 | public function toArray() |
||
| 46 | { |
||
| 47 | return $this->getHydrator()->extract($this); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * To json. |
||
| 52 | * |
||
| 53 | * @return string Json |
||
| 54 | */ |
||
| 55 | public function toJson() |
||
| 58 | } |
||
| 59 | } |
||
| 60 |