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.

RangeFile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

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