| Total Complexity | 5 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class CallableNormalizer implements NormalizerInterface |
||
| 8 | { |
||
| 9 | private \Closure $callback; |
||
| 10 | private ?NormalizerInterface $normalizer; |
||
| 11 | |||
| 12 | public function __construct(callable $callback, ?NormalizerInterface $normalizer = null) |
||
| 13 | { |
||
| 14 | $this->callback = \Closure::fromCallable($callback); |
||
| 15 | $this->normalizer = $normalizer; |
||
| 16 | } |
||
| 17 | |||
| 18 | /** @psalm-suppress UnsafeInstantiation */ |
||
| 19 | public static function create(callable $callback, ?NormalizerInterface $normalizer = null): self |
||
| 20 | { |
||
| 21 | return new static($callback, $normalizer); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getCallback(): callable |
||
| 25 | { |
||
| 26 | return $this->callback; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** @return mixed */ |
||
| 30 | public function normalize(string $value) |
||
| 39 | } |
||
| 40 | } |
||
| 41 |