GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 4.2-to-master ( ed215f )
by E
06:47
created

Configuration::getGoogleAnalytics()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace ApiGen\Configuration;
4
5
use ApiGen\Contracts\Configuration\ConfigurationInterface;
6
7
final class Configuration implements ConfigurationInterface
8
{
9
    /**
10
     * @var mixed[]
11
     */
12
    private $options;
13
14
    /**
15
     * @var ConfigurationOptionsResolver
16
     */
17
    private $configurationOptionsResolver;
18
19
    public function __construct(ConfigurationOptionsResolver $configurationOptionsResolver)
20
    {
21
        $this->configurationOptionsResolver = $configurationOptionsResolver;
22
    }
23
24
    /**
25
     * @param mixed[] $options
26
     * @return mixed[]
27
     */
28
    public function resolveOptions(array $options): array
29
    {
30
        $options = $this->unsetConsoleOptions($options);
31
        return $this->options = $this->configurationOptionsResolver->resolve($options);
32
    }
33
34
    /**
35
     * @return mixed|null
36
     */
37
    public function getOption(string $name)
38
    {
39
        if (isset($this->getOptions()[$name])) {
40
            return $this->getOptions()[$name];
41
        }
42
43
        return null;
44
    }
45
46
    /**
47
     * @return mixed[]
48
     */
49
    public function getOptions(): array
50
    {
51
        if ($this->options === null) {
52
            $this->resolveOptions([]);
53
        }
54
55
        return $this->options;
56
    }
57
58
    /**
59
     * @param mixed[] $options
60
     */
61
    public function setOptions(array $options): void
62
    {
63
        $this->options = $options;
64
    }
65
66
    public function getVisibilityLevel(): int
67
    {
68
        return $this->options[ConfigurationOptions::VISIBILITY_LEVELS];
69
    }
70
71
    /**
72
     * @return string[]
73
     */
74
    public function getAnnotationGroups(): array
75
    {
76
        return $this->options[ConfigurationOptions::ANNOTATION_GROUPS];
77
    }
78
79
    public function getDestination(): string
80
    {
81
        return $this->options[ConfigurationOptions::DESTINATION];
82
    }
83
84
    public function getTitle(): string
85
    {
86
        return $this->options[ConfigurationOptions::TITLE];
87
    }
88
89
    public function getBaseUrl(): string
90
    {
91
        return $this->options[ConfigurationOptions::BASE_URL];
92
    }
93
94
    public function getGoogleAnalytics(): string
95
    {
96
        return $this->options[ConfigurationOptions::GOOGLE_ANALYTICS];
97
    }
98
99
    /**
100
     * @return array|string[]
101
     */
102
    public function getSource(): array
103
    {
104
        return $this->options[ConfigurationOptions::SOURCE];
105
    }
106
107
    /**
108
     * @return array|string[]
109
     */
110
    public function getExclude(): array
111
    {
112
        return $this->options[ConfigurationOptions::EXCLUDE];
113
    }
114
115
    /**
116
     * @return string[]
117
     */
118
    public function getExtensions(): array
119
    {
120
        return $this->options[ConfigurationOptions::EXTENSIONS];
121
    }
122
123
    /**
124
     * @param mixed[] $options
125
     * @return mixed[]
126
     */
127
    private function unsetConsoleOptions(array $options): array
128
    {
129
        unset(
130
            $options['ansi'], $options['no-ansi'], $options['no-interaction'], $options['config'],
131
            $options['help'], $options['quiet'], $options['verbose'], $options['version']
132
        );
133
        return $options;
134
    }
135
}
136