, * Pádraic Brady * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Humbug\PhpScoper\Scoper; use Humbug\PhpScoper\Scoper; use Humbug\PhpScoper\Whitelist; use function array_reduce; use function func_get_args; final class PatchScoper implements Scoper { private $decoratedScoper; public function __construct(Scoper $decoratedScoper) { $this->decoratedScoper = $decoratedScoper; } /** * @inheritdoc */ public function scope(string $filePath, string $contents, string $prefix, array $patchers, Whitelist $whitelist): string { return (string) array_reduce( $patchers, static function (string $contents, callable $patcher) use ($filePath, $prefix): string { return $patcher($filePath, $prefix, $contents); }, $this->decoratedScoper->scope(...func_get_args()) ); } }