for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the box project.
*
* (c) Kevin Herrera <[email protected]>
* Théo Fidry <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace KevinGH\Box\PhpScoper;
use Humbug\PhpScoper\Scoper\Scoper as PhpScoperScoper;
use function array_flip;
use function array_key_exists;
use function func_get_args;
final class ExcludedFilesScoper implements PhpScoperScoper
{
private readonly array $excludedFilePathsAsKeys;
public function __construct(
private readonly PhpScoperScoper $decoratedScoper,
string ...$excludedFilePaths,
) {
$this->excludedFilePathsAsKeys = array_flip($excludedFilePaths);
excludedFilePathsAsKeys
KevinGH\Box\PhpScoper\ExcludedFilesScoper
}
public function scope(string $filePath, string $contents): string
if (array_key_exists($filePath, $this->excludedFilePathsAsKeys)) {
return $contents;
return $this->decoratedScoper->scope(...func_get_args());