| 1 | <?php namespace App\LaravelRestCms; |
||
| 3 | trait HierarchyTransformerTrait { |
||
| 4 | |||
| 5 | /** |
||
| 6 | * The transformer of the parent (usually itself) |
||
| 7 | * |
||
| 8 | * @var string |
||
| 9 | */ |
||
| 10 | protected $parentTransformer; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Sets instance vars and adds includes |
||
| 14 | * |
||
| 15 | * @param string $parentTransformer |
||
| 16 | * @param string $method |
||
| 17 | */ |
||
| 18 | protected function setupHierarchy($parentTransformer, $method = 'parent') |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Include Parent |
||
| 26 | * |
||
| 27 | * @param \App\LaravelRestCms\BaseModel |
||
| 28 | * @return \League\Fractal\ItemResource |
||
| 29 | */ |
||
| 30 | public function includeParent(BaseModel $model) |
||
| 34 | |||
| 35 | } |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.