Passed
Pull Request — master (#488)
by Théo
02:04
created

Configuration   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 77
rs 10
ccs 4
cts 8
cp 0.5
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getWhitelist() 0 3 1
A __construct() 0 14 1
A getPatchers() 0 3 1
A getWhitelistedFiles() 0 3 1
A getPath() 0 3 1
A getPrefix() 0 3 1
A getFilesWithContents() 0 3 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;
16
17
final class Configuration
18
{
19
    private ?string $path;
20
    private string $prefix;
21
    private array $filesWithContents;
22
    private array $patchers;
23
    private Whitelist $whitelist;
24
    private array $whitelistedFiles;
25
26
    /**
27
     * @param string|null $path                   Absolute path to the configuration file loaded.
28
     * @param string      $prefix                 The prefix applied.
29
     * @param array<string, array{string, string}> $filesWithContents      Array of tuple with the
1 ignored issue
show
Documentation Bug introduced by
The doc comment array<string, array{string, string}> at position 6 could not be parsed: Expected ':' at position 6, but found 'string'.
Loading history...
30
     *                                            first argument being the file path and the second
31
     *                                            its contents
32
     * @param callable[]  $patchers               List of closures which can alter the content of
33
     *                                            the files being scoped.
34
     * @param Whitelist   $whitelist              List of classes that will not be scoped.
35
     *                                            returning a boolean which if `true` means the
36
     *                                            class should be scoped
37
     *                                            (i.e. is ignored) or scoped otherwise.
38
     * @param string[]    $whitelistedFiles       List of absolute paths of files to completely
39
     *                                            ignore
40
     */
41
    public function __construct(
42
        ?string $path,
43
        string $prefix,
44
        array $filesWithContents,
45
        array $patchers,
46
        Whitelist $whitelist,
47
        array $whitelistedFiles
48
    ) {
49
        $this->path = $path;
50
        $this->prefix = $prefix;
51
        $this->filesWithContents = $filesWithContents;
52
        $this->patchers = $patchers;
53
        $this->whitelist = $whitelist;
54
        $this->whitelistedFiles = $whitelistedFiles;
55
    }
56
57
    public function getPath(): ?string
58
    {
59
        return $this->path;
60
    }
61
62
    public function getPrefix(): string
63
    {
64
        return $this->prefix;
65
    }
66
67
    /**
68
     * @return array<string, array{string, string}>
1 ignored issue
show
Documentation Bug introduced by
The doc comment array<string, array{string, string}> at position 6 could not be parsed: Expected ':' at position 6, but found 'string'.
Loading history...
69
     */
70
    public function getFilesWithContents(): array
71
    {
72
        return $this->filesWithContents;
73
    }
74
75
    /**
76
     * @return callable[]
77
     */
78
    public function getPatchers(): array
79 3
    {
80
        return $this->patchers;
81 3
    }
82 1
83
    public function getWhitelist(): Whitelist
84 2
    {
85
        return $this->whitelist;
86
    }
87
88
    /**
89
     * @return string[]
90
     */
91
    public function getWhitelistedFiles(): array
92
    {
93
        return $this->whitelistedFiles;
94 2
    }
95
}
96