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.

GlobStreamWrapper::dir_closedir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Gielfeldt\Iterators;
4
5
/**
6
 * Stream wrapper providing recursive glob functionality.
7
 */
8
class GlobStreamWrapper
9
{
10
11
    protected $directoryIterator;
12
13
    protected static $root;
14
15 1
    public static function setRoot($root)
16
    {
17 1
        self::$root = $root;
18 1
    }
19
20
    /**
21
     * @param string $path
22
     */
23 1
    protected static function getRootedPath($path)
24
    {
25
        // Avoid infinite recursion.
26 1
        if (strpos($path, 'glob://') === 0) {
27 1
            $path = substr($path, 7);
28
        }
29
30 1
        return self::$root . $path;
31
    }
32
33
    /**
34
     * @see streamWrapper::dir_opendir()
35
     */
36 1
    public function dir_opendir(string $path, int $options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38 1
        $path = self::getRootedPath($path);
39
40
        // Setup recursive glob iterator and rewind.
41 1
        $this->directoryIterator = new GlobIterator($path);
42 1
        $this->directoryIterator->rewind();
43 1
        return true;
44
    }
45
46
    /**
47
     * @see streamWrapper::dir_readdir()
48
     */
49 1
    public function dir_readdir()
50
    {
51 1
        $current = $this->directoryIterator->current();
52 1
        $this->directoryIterator->next();
53 1
        $filename = $current ? str_replace($this->directoryIterator->getPath(), '', $current->getPathname()) : false;
54 1
        return $filename;
55
    }
56
57
    /**
58
     * @see streamWrapper::dir_rewinddir()
59
     */
60 1
    public function dir_rewinddir()
61
    {
62 1
        $this->directoryIterator->rewind();
63 1
        return true;
64
    }
65
66
    /**
67
     * @see streamWrapper::dir_closedir()
68
     */
69 1
    public function dir_closedir()
70
    {
71 1
        unset($this->directoryIterator);
72 1
        return true;
73
    }
74
}
75