1 | <?php |
||
15 | class TransformableCollection extends Collection |
||
16 | { |
||
17 | /** |
||
18 | * Fully Qualified Namespace to the Transformers |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $namespace = 'Spinen\Transformers'; |
||
23 | |||
24 | /** |
||
25 | * Build out the namespace to the transformers |
||
26 | * |
||
27 | * @return string |
||
28 | */ |
||
29 | public function getNamespace() |
||
33 | |||
34 | /** |
||
35 | * Make a transformer |
||
36 | * |
||
37 | * Allow the full path to the transformer class be specified or just the short name where it is concatenated to the |
||
38 | * getNamespace method. |
||
39 | * |
||
40 | * @param string $class |
||
41 | * |
||
42 | * @return \Illuminate\Foundation\Application|mixed |
||
43 | */ |
||
44 | public function getTransformer($class) |
||
51 | |||
52 | public function getTransformerClass($class) |
||
62 | |||
63 | /** |
||
64 | * Transform the data |
||
65 | * |
||
66 | * @param string $class |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | protected function runTransformation($class) |
||
76 | |||
77 | /** |
||
78 | * Transform the collection |
||
79 | * |
||
80 | * You pass in a class name that is assume that the classes are located in app/Transformers/ |
||
81 | * |
||
82 | * @param string $class |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | public function transformTo($class) |
||
90 | |||
91 | /** |
||
92 | * Transform the collection to a paginated collection |
||
93 | * |
||
94 | * @param string $class |
||
95 | * |
||
96 | * @return LengthAwarePaginator |
||
97 | */ |
||
98 | public function transformToWithPagination($class) |
||
108 | } |
||
109 |