| Total Complexity | 11 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class AbstractPresenter extends Presenter implements JsonSerializable, QueueableEntity |
||
| 15 | { |
||
| 16 | private $relationMapping = []; |
||
| 17 | |||
| 18 | public function __isset($key) |
||
| 19 | { |
||
| 20 | return $this->offsetExists($key); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function __get($key) |
||
| 24 | { |
||
| 25 | if ($this->isRelationMutator($key)) { |
||
| 26 | return $this->mutateRelation($key); |
||
| 27 | } |
||
| 28 | return parent::__get($key); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getQueueableId() |
||
| 32 | { |
||
| 33 | return $this->model->getQueueableId(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getQueueableRelations() |
||
| 37 | { |
||
| 38 | return $this->model->getQueueableRelations(); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getQueueableConnection() |
||
| 44 | } |
||
| 45 | |||
| 46 | public function jsonSerialize() |
||
| 47 | { |
||
| 48 | return $this->toArray(); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function relationPresenters(array $mapping): self |
||
| 52 | { |
||
| 53 | $this->relationMapping = $mapping; |
||
| 54 | return $this; |
||
| 55 | } |
||
| 56 | |||
| 57 | private function isRelationMutator($key): bool |
||
| 58 | { |
||
| 59 | return array_key_exists($key, $this->relationMapping); |
||
| 60 | } |
||
| 61 | |||
| 62 | private function mutateRelation($key) |
||
| 70 | } |
||
| 71 | } |
||
| 72 |