1 | <?php |
||
21 | abstract class AbstractResourceTransformer extends AbstractTransformer implements ResourceTransformerInterface |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var mixed |
||
26 | */ |
||
27 | protected $data; |
||
28 | |||
29 | /** |
||
30 | * @var callable|TransformerInterface |
||
31 | */ |
||
32 | protected $transformer; |
||
33 | |||
34 | /** |
||
35 | * @param Scope $scope |
||
36 | * @return ResourceInterface |
||
37 | */ |
||
38 | protected abstract function createResource(Scope $scope): ResourceInterface; |
||
39 | |||
40 | /** |
||
41 | * @param Scope $scope |
||
42 | * @return mixed |
||
43 | */ |
||
44 | protected function getData(Scope $scope) |
||
48 | |||
49 | /** |
||
50 | * @param Scope $scope |
||
51 | * @param string|null $identifier |
||
52 | * @return mixed |
||
53 | */ |
||
54 | public function transform(Scope $scope, string $identifier = null) |
||
71 | |||
72 | /** |
||
73 | * @param callable $transformer |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function setTransformer(callable $transformer) |
||
81 | |||
82 | /** |
||
83 | * @param mixed $data |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function setData($data) |
||
91 | |||
92 | /** |
||
93 | * @inheritdoc |
||
94 | */ |
||
95 | public function __invoke($data, Scope $scope, string $identifier = null) |
||
99 | |||
100 | } |