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.

Storage   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
c 1
b 0
f 0
dl 0
loc 51
ccs 17
cts 17
cp 1
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoadedPaths() 0 4 1
A getPath() 0 10 2
A markLoaded() 0 4 1
A addPath() 0 6 2
A isLoaded() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace Enjoys\Dotenv;
7
8
9
final class Storage implements StorageInterface
10
{
11
    /**
12
     * @var string[]
13
     */
14
    private array $loadedPaths = [];
15
    /**
16
     * @var string[]
17
     */
18
    private array $paths = [];
19
20 44
    #[\Override]
21
    public function getPath(): string|false
22
    {
23 44
        $key = key($this->paths);
24 44
        if ($key === null) {
25 42
            return false;
26
        }
27 44
        $result = $this->paths[$key];
28 44
        unset($this->paths[$key]);
29 44
        return $result;
30
    }
31
32 44
    #[\Override]
33
    public function isLoaded(string $path): bool
34
    {
35 44
        return in_array($path, $this->loadedPaths, true);
36
    }
37
38 42
    #[\Override]
39
    public function markLoaded(string $path): void
40
    {
41 42
        $this->loadedPaths[] = $path;
42
    }
43
44 44
    #[\Override]
45
    public function addPath(string $path): void
46
    {
47 44
        $path = realpath($path);
48 44
        if ($path !== false) {
49 44
            $this->paths[] = $path;
50
        }
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56 2
    #[\Override]
57
    public function getLoadedPaths(): array
58
    {
59 2
        return $this->loadedPaths;
60
    }
61
}
62