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.

RangeFileDirectory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 69
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
createFileFromRangeAndTotal() 0 1 ?
A addFileFromRangeAndTotal() 0 6 1
A getFileFromValue() 0 4 1
A getFiles() 0 4 1
A writeRange() 0 5 1
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\FileRepository;
4
5
use UCD\Exception\UnexpectedValueException;
6
7
abstract class RangeFileDirectory
8
{
9
    /**
10
     * @var \SplFileInfo
11
     */
12
    protected $basePath;
13
14
    /**
15
     * @var RangeFiles
16
     */
17
    private $files;
18
19
    /**
20
     * @param \SplFileInfo $basePath
21
     * @param RangeFiles $files
22
     */
23
    public function __construct(\SplFileInfo $basePath, RangeFiles $files)
24
    {
25
        $this->basePath = $basePath;
26
        $this->files = $files;
27
    }
28
29
    /**
30
     * @param Range $range
31
     * @param int $total
32
     * @return RangeFile
33
     */
34
    abstract protected function createFileFromRangeAndTotal(Range $range, $total);
35
36
    /**
37
     * @param Range $range
38
     * @param int $total
39
     * @return RangeFile
40
     */
41
    public function addFileFromRangeAndTotal(Range $range, $total)
42
    {
43
        $file = $this->createFileFromRangeAndTotal($range, $total);
44
45
        return $this->files->add($file);
46
    }
47
48
    /**
49
     * @param int $value
50
     * @return RangeFile|null
51
     * @throws UnexpectedValueException
52
     */
53
    public function getFileFromValue($value)
54
    {
55
        return $this->files->getForValue($value);
56
    }
57
58
    /**
59
     * @return RangeFiles|RangeFile[]
60
     */
61
    public function getFiles()
62
    {
63
        return $this->files;
64
    }
65
66
    /**
67
     * @param Range $range
68
     * @param array $map
69
     */
70
    public function writeRange(Range $range, array $map)
71
    {
72
        $rangeFile = $this->addFileFromRangeAndTotal($range, count($map));
73
        $rangeFile->write($map);
74
    }
75
}