| 1 | <?php |
||
| 21 | abstract class AbstractResourceTransformer extends AbstractTransformer |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var mixed |
||
| 26 | */ |
||
| 27 | public $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 | * @param string|null $identifier |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | public function transform(Scope $scope, string $identifier = null) |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param callable $transformer |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | public function setTransformer(callable $transformer) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @inheritdoc |
||
| 71 | */ |
||
| 72 | public function __invoke($data, Scope $scope, string $identifier = null) |
||
| 76 | |||
| 77 | } |