| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | final class PatcherChain implements Patcher |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var array<(callable(string, string, string): string)|Patcher> |
||
|
|
|||
| 23 | */ |
||
| 24 | private array $patchers; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param array<(callable(string, string, string): string)|Patcher> $patchers |
||
| 28 | */ |
||
| 29 | public function __construct(array $patchers = []) |
||
| 30 | { |
||
| 31 | $this->patchers = $patchers; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function __invoke(string $filePath, string $prefix, string $contents): string |
||
| 35 | { |
||
| 36 | return array_reduce( |
||
| 37 | $this->patchers, |
||
| 38 | static fn (string $contents, callable $patcher) => $patcher($filePath, $prefix, $contents), |
||
| 39 | $contents, |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @internal |
||
| 45 | * |
||
| 46 | * @return array<(callable(string, string, string): string)|Patcher> |
||
| 47 | */ |
||
| 48 | public function getPatchers(): array |
||
| 51 | } |
||
| 52 | } |
||
| 53 |