PatchScoper::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
ccs 1
cts 1
cp 1
crap 1
rs 10
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