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.

SitemapDefinition::getTtl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
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
    public function __construct(string $type, array $settings = [])
27
    {
28
        $this->settings = $settings;
29
        $this->type     = $type;
30
    }
31
32
    public function __toString()
33
    {
34
        return $this->toString();
35
    }
36
37
    public function toString(): string
38
    {
39
        return $this->getType() ?: 'n/a';
40
    }
41
42
    public function getType(): string
43
    {
44
        return $this->type;
45
    }
46
47
    public function setSettings(array $settings = []): void
48
    {
49
        $this->settings = $settings;
50
    }
51
52
    public function getSettings(): array
53
    {
54
        return $this->settings;
55
    }
56
57
    public function getSetting(string $name, $default = null)
58
    {
59
        return $this->settings[$name] ?? $default;
60
    }
61
62
    public function getTtl(): int
63
    {
64
        if (true !== $this->getSetting('use_cache', true)) {
65
            return 0;
66
        }
67
68
        return (int) $this->getSetting('ttl', 0);
69
    }
70
}
71