ConfigurableScoper::scope()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 1
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the humbug/php-scoper package.
7
 *
8
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
9
 *                    Pádraic Brady <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Humbug\PhpScoper\Scoper;
16
17
use function count;
18
use function func_get_args;
19
20
/**
21
 * @deprecated since 0.16. Will be removed in 0.17.
22
 */
23
final class ConfigurableScoper implements Scoper
24
{
25 2
    private Scoper $decoratedScoper;
26
27 2
    public function __construct(Scoper $decoratedScoper)
28
    {
29
        $this->decoratedScoper = $decoratedScoper;
30 1
    }
31
32 1
    public function withWhitelistedFiles(string ...$whitelistedFiles): self
33
    {
34 1
        return count($whitelistedFiles) === 0
35
            ? $this
36 1
            : new self(
37 1
                new FileWhitelistScoper(
38 1
                    clone $this,
39 1
                    ...$whitelistedFiles,
40
                ),
41
            );
42
    }
43
44
    public function scope(string $filePath, string $contents): string
45
    {
46
        return $this->decoratedScoper->scope(...func_get_args());
47
    }
48
}
49