| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | abstract class ExportBase implements Export |
||
| 20 | { |
||
| 21 | |||
| 22 | /** @var HierarchyBase Hierarchy object to export */ |
||
| 23 | protected HierarchyBase $object; |
||
| 24 | protected array $modifiers = []; |
||
| 25 | |||
| 26 | 12 | public function __construct(HierarchyBase $object) { |
|
| 27 | 12 | $this->object = $object; |
|
| 28 | 12 | } |
|
| 29 | |||
| 30 | /** |
||
| 31 | * Finish the export query -> get the result |
||
| 32 | * |
||
| 33 | * @return array The query result |
||
| 34 | */ |
||
| 35 | 11 | public function get() : array { |
|
| 36 | 11 | $data = $this->getBasic(); |
|
| 37 | 11 | $this->applyModifiers($data); |
|
| 38 | 11 | return array_map(static function(object $object) { |
|
| 39 | 11 | unset($object->object); |
|
| 40 | 11 | return $object; |
|
| 41 | 11 | }, $data); |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Apply set modifiers to data array |
||
| 46 | * |
||
| 47 | * @param array $data |
||
| 48 | */ |
||
| 49 | 11 | protected function applyModifiers(array &$data) : void { |
|
| 52 | } |
||
| 53 | } |
||
| 54 | } |