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 — master ( b10e46...20af00 )
by Christian
263:11
created

SitemapDefinition::getSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\SitemapBundle\Definition;
13
14
final class SitemapDefinition implements SitemapDefinitionInterface
15
{
16
    /**
17
     * @var array
18
     */
19
    private $settings;
20
21
    /**
22
     * @var string
23
     */
24
    private $type;
25
26
    /**
27
     * @param string $type
28
     * @param array  $settings
29
     */
30
    public function __construct(string $type, array $settings = [])
31
    {
32
        $this->settings = $settings;
33
        $this->type     = $type;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function __toString()
40
    {
41
        return $this->getType() ?: 'n/a';
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getType(): string
48
    {
49
        return $this->type;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function setSettings(array $settings = []): void
56
    {
57
        $this->settings = $settings;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getSettings(): array
64
    {
65
        return $this->settings;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getSetting(string $name, $default = null)
72
    {
73
        return $this->settings[$name] ?? $default;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function getTtl(): int
80
    {
81
        if (!$this->getSetting('use_cache', true)) {
82
            return 0;
83
        }
84
85
        return (int) $this->getSetting('ttl', 0);
86
    }
87
}
88