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.
Passed
Pull Request — master (#8)
by Brent
01:44
created

Line   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 13
dl 0
loc 39
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMaximumCharacterPositionDensity() 0 5 2
A merge() 0 9 2
A make() 0 9 1
A offsetGet() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Spatie\CodeOutline;
4
5
use Spatie\Typed\Collection;
6
use Spatie\Typed\T;
7
8
class Line extends Collection
9
{
10
    public function __construct(int ...$values)
11
    {
12
        parent::__construct(T::int(), $values);
13
    }
14
15
    public static function make(int $indentationCount, int $characterCount): Line
16
    {
17
        $indentationValues = array_fill(0, $indentationCount, -1);
18
19
        $characterValues = array_fill(0, $characterCount, 1);
20
21
        $lineValues = array_merge($indentationValues, $characterValues);
22
23
        return new self(...$lineValues);
24
    }
25
26
    public function merge(Line $line): Line
27
    {
28
        $mergedLine = clone $this;
29
30
        foreach ($line as $position => $value) {
31
            $mergedLine[$position] = ($this[$position] ?? 0) + $value;
32
        }
33
34
        return $mergedLine;
35
    }
36
37
    public function getMaximumCharacterPositionDensity(): int
38
    {
39
        return $this->count()
40
            ? max($this->data)
41
            : 0;
42
    }
43
44
    public function offsetGet($offset): int
45
    {
46
        return parent::offsetGet($offset);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::offsetGet($offset) could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
47
    }
48
}
49