1 | <?php |
||
10 | class NotificationTransformer extends BaseTransformer |
||
11 | { |
||
12 | /** |
||
13 | * Resources that can be included if requested. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $availableIncludes = ['from_user', 'topic', 'reply']; |
||
18 | |||
19 | /** |
||
20 | * Transform the \Notification entity. |
||
21 | * |
||
22 | * @param Notification $model |
||
23 | * |
||
24 | * @return array |
||
25 | */ |
||
26 | public function transformData($model) |
||
34 | |||
35 | public function includeFromUser($model) |
||
39 | |||
40 | public function includeReply($model) |
||
48 | |||
49 | public function includeTopic($model) |
||
57 | } |
||
58 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: