| 1 | <?php namespace App\LaravelRestCms; |
||
| 5 | trait HierarchyTransformerTrait { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * The transformer of the parent (usually itself) |
||
| 9 | * |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $parentTransformer; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Sets instance vars and adds includes |
||
| 16 | * |
||
| 17 | * @param string $parentTransformer |
||
| 18 | * @param string $method |
||
| 19 | */ |
||
| 20 | protected function setupHierarchy($parentTransformer, $method = 'parent') |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Include Parent |
||
| 28 | * |
||
| 29 | * @param \App\LaravelRestCms\BaseModel |
||
| 30 | * @return \League\Fractal\ItemResource |
||
| 31 | */ |
||
| 32 | public function includeParent(BaseModel $model) |
||
| 36 | |||
| 37 | } |
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.