| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | abstract class TransformationProviderAbstract implements TransformationProvider |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | private $transformations; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param array $transformations An array of key/value pairs where _key_ is a supported class and _value_ |
||
| 26 | * a transformation. What qualifies as _transformation_ depends on the implementation. It could be a |
||
| 27 | * Transformation instance, a callable, or a reference to a service… |
||
| 28 | */ |
||
| 29 | public function __construct(array $transformations) |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @inheritdoc |
||
| 36 | */ |
||
| 37 | public function __invoke($data): callable |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Resolves a transformation. |
||
| 56 | * |
||
| 57 | * @param mixed $transformation |
||
| 58 | * |
||
| 59 | * @return Transformation|callable |
||
| 60 | */ |
||
| 61 | abstract protected function resolve($transformation): callable; |
||
| 62 | } |
||
| 63 |