PatchScoper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 19
rs 10
c 1
b 0
f 0
ccs 6
cts 6
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scope() 0 6 1
A __construct() 0 5 1
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 Humbug\PhpScoper\Patcher\Patcher;
18
use function func_get_args;
19
20
final class PatchScoper implements Scoper
21
{
22
    private Scoper $decoratedScoper;
23
    private string $prefix;
24
    private Patcher $patcher;
25 1
26
    public function __construct(Scoper $decoratedScoper, string $prefix, Patcher $patcher)
27 1
    {
28
        $this->decoratedScoper = $decoratedScoper;
29
        $this->prefix = $prefix;
30
        $this->patcher = $patcher;
31
    }
32
33 1
    public function scope(string $filePath, string $contents): string
34
    {
35 1
        return ($this->patcher)(
36
            $filePath,
37 1
            $this->prefix,
38 1
            $this->decoratedScoper->scope(...func_get_args()),
39
        );
40 1
    }
41
}
42