1 | <?php |
||
16 | trait OverridesFractal |
||
17 | { |
||
18 | /** |
||
19 | * Overrides Fractal's getter for available includes. |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | 5 | public function getAvailableIncludes() |
|
33 | |||
34 | /** |
||
35 | * Overrides Fractal's getter for default includes. |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | public function getDefaultIncludes() |
||
45 | |||
46 | /** |
||
47 | * Overrides Fractal's method for including a relation. |
||
48 | * |
||
49 | * @param \League\Fractal\Scope $scope |
||
50 | * @param string $identifier |
||
51 | * @param mixed $data |
||
52 | * @return \League\Fractal\Resource\ResourceInterface |
||
53 | */ |
||
54 | 3 | protected function callIncludeMethod(Scope $scope, $identifier, $data) |
|
60 | |||
61 | /** |
||
62 | * Resolve scoped includes for the given scope. |
||
63 | * |
||
64 | * @param \League\Fractal\Scope $scope |
||
65 | * @return array |
||
66 | */ |
||
67 | 1 | protected function resolveScopedIncludes(Scope $scope): array |
|
78 | |||
79 | /** |
||
80 | * Resolve scoped parameters for the given scope. |
||
81 | * |
||
82 | * @param \League\Fractal\Scope $scope |
||
83 | * @param string $identifier |
||
84 | * @return array |
||
85 | */ |
||
86 | 3 | protected function resolveScopedParameters(Scope $scope, string $identifier): array |
|
90 | |||
91 | /** |
||
92 | * Get the current scope of the transformer. |
||
93 | * |
||
94 | * @return \League\Fractal\Scope |
||
95 | */ |
||
96 | public abstract function getCurrentScope(); |
||
97 | |||
98 | /** |
||
99 | * Include a related resource. |
||
100 | * |
||
101 | * @param string $identifier |
||
102 | * @param mixed $data |
||
103 | * @param array $parameters |
||
104 | * @return \League\Fractal\Resource\ResourceInterface |
||
105 | */ |
||
106 | protected abstract function includeResource(string $identifier, $data, array $parameters): ResourceInterface; |
||
107 | } |