Passed
Push — master ( 8feb2a...cb2398 )
by Théo
01:57
created

SymbolsConfiguration::getExcludedClasses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Configuration;
16
17
use Humbug\PhpScoper\Symbol\NamespaceRegistry;
18
use Humbug\PhpScoper\Symbol\SymbolRegistry;
19
20
final class SymbolsConfiguration
21
{
22
    private bool $exposeGlobalConstants;
23
    private bool $exposeGlobalClasses;
24
    private bool $exposeGlobalFunctions;
25
26
    private NamespaceRegistry $excludedNamespaces;
27
    private NamespaceRegistry $exposedNamespaces;
28
29
    private SymbolRegistry $exposedClasses;
30
    private SymbolRegistry $exposedFunctions;
31
    private SymbolRegistry $exposedConstants;
32
33
    private SymbolRegistry $excludedClasses;
34
    private SymbolRegistry $excludedFunctions;
35
    private SymbolRegistry $excludedConstants;
36
37
    public static function create(
38
        bool $exposeGlobalConstants = false,
39
        bool $exposeGlobalClasses = false,
40
        bool $exposeGlobalFunctions = false,
41
        ?NamespaceRegistry $excludedNamespaces = null,
42
        // Does not contain the list of excluded symbols which go to the
43
        // Reflector (which has no notion of namespaces)
44
        ?NamespaceRegistry $exposedNamespaces = null,
45
        ?SymbolRegistry $exposedClasses = null,
46
        ?SymbolRegistry $exposedFunctions = null,
47
        ?SymbolRegistry $exposedConstants = null,
48
        ?SymbolRegistry $excludedClasses = null,
49
        ?SymbolRegistry $excludedFunctions = null,
50
        ?SymbolRegistry $excludedConstants = null
51
    ): self {
52
        return new self(
53
            $exposeGlobalConstants,
54
            $exposeGlobalClasses,
55
            $exposeGlobalFunctions,
56
            $excludedNamespaces ?? NamespaceRegistry::create(),
57
            $exposedNamespaces ?? NamespaceRegistry::create(),
58
            $exposedClasses ?? SymbolRegistry::create(),
59
            $exposedFunctions ?? SymbolRegistry::create(),
60
            $exposedConstants ?? SymbolRegistry::createForConstants(),
61
            $excludedClasses ?? SymbolRegistry::create(),
62
            $excludedFunctions ?? SymbolRegistry::create(),
63
            $excludedConstants ?? SymbolRegistry::createForConstants(),
64
        );
65
    }
66
67
    private function __construct(
68
        bool $exposeGlobalConstants,
69
        bool $exposeGlobalClasses,
70
        bool $exposeGlobalFunctions,
71
        NamespaceRegistry $excludedNamespaces,
72
        NamespaceRegistry $exposedNamespaces,
73
        SymbolRegistry $exposedClasses,
74
        SymbolRegistry $exposedFunctions,
75
        SymbolRegistry $exposedConstants,
76
        SymbolRegistry $excludedClasses,
77
        SymbolRegistry $excludedFunctions,
78
        SymbolRegistry $excludedConstants
79
    ) {
80
        $this->exposeGlobalConstants = $exposeGlobalConstants;
81
        $this->exposeGlobalClasses = $exposeGlobalClasses;
82
        $this->exposeGlobalFunctions = $exposeGlobalFunctions;
83
        $this->excludedNamespaces = $excludedNamespaces;
84
        $this->exposedNamespaces = $exposedNamespaces;
85
        $this->exposedClasses = $exposedClasses;
86
        $this->exposedFunctions = $exposedFunctions;
87
        $this->exposedConstants = $exposedConstants;
88
        $this->excludedClasses = $excludedClasses;
89
        $this->excludedFunctions = $excludedFunctions;
90
        $this->excludedConstants = $excludedConstants;
91
    }
92
93
    public function shouldExposeGlobalConstants(): bool
94
    {
95
        return $this->exposeGlobalConstants;
96
    }
97
98
    public function shouldExposeGlobalClasses(): bool
99
    {
100
        return $this->exposeGlobalClasses;
101
    }
102
103
    public function shouldExposeGlobalFunctions(): bool
104
    {
105
        return $this->exposeGlobalFunctions;
106
    }
107
108
    public function getExcludedNamespaces(): NamespaceRegistry
109
    {
110
        return $this->excludedNamespaces;
111
    }
112
113
    public function getExposedNamespaces(): NamespaceRegistry
114
    {
115
        return $this->exposedNamespaces;
116
    }
117
118
    public function getExposedClasses(): SymbolRegistry
119
    {
120
        return $this->exposedClasses;
121
    }
122
123
    public function getExposedFunctions(): SymbolRegistry
124
    {
125
        return $this->exposedFunctions;
126
    }
127
128
    public function getExposedConstants(): SymbolRegistry
129
    {
130
        return $this->exposedConstants;
131
    }
132
133
    public function getExcludedClasses(): SymbolRegistry
134
    {
135
        return $this->excludedClasses;
136
    }
137
138
    public function getExcludedFunctions(): SymbolRegistry
139
    {
140
        return $this->excludedFunctions;
141
    }
142
143
    public function getExcludedConstants(): SymbolRegistry
144
    {
145
        return $this->excludedConstants;
146
    }
147
}
148