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
Push — master ( ee75bb...4e2b38 )
by Carlos
11:23
created

Collection   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 64
rs 10
wmc 13

12 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 3 1
A offsetExists() 0 3 1
A offsetSet() 0 6 2
A jsonSerialize() 0 3 1
A all() 0 3 1
A toArray() 0 3 1
A join() 0 3 1
A offsetGet() 0 3 1
A offsetUnset() 0 3 1
A __construct() 0 3 1
A toJson() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
namespace Overtrue\Pinyin;
4
5
use ArrayAccess;
6
use JsonSerializable;
7
use Stringable;
8
9
class Collection implements ArrayAccess, JsonSerializable, Stringable
10
{
11
    public function __construct(protected $items = [])
12
    {
13
        $this->items = \array_values($this->items);
14
    }
15
16
    public function join(string $separator = ' '): string
17
    {
18
        return implode($separator, $this->all());
19
    }
20
21
    public function map(callable $callback): Collection
22
    {
23
        return new static(array_map($callback, $this->all()));
24
    }
25
26
    public function all(): array
27
    {
28
        return \array_values($this->items);
29
    }
30
31
    public function toArray(): array
32
    {
33
        return $this->all();
34
    }
35
36
    public function toJson(int $options = 0): string
37
    {
38
        return json_encode($this->all(), $options);
39
    }
40
41
    public function __toString()
42
    {
43
        return $this->join();
44
    }
45
46
    public function offsetExists(mixed $offset): bool
47
    {
48
        return isset($this->items[$offset]);
49
    }
50
51
    public function offsetGet(mixed $offset): mixed
52
    {
53
        return $this->items[$offset] ?? null;
54
    }
55
56
    public function offsetSet(mixed $offset, mixed $value): void
57
    {
58
        if (null === $offset) {
59
            $this->items[] = $value;
60
        } else {
61
            $this->items[$offset] = $value;
62
        }
63
    }
64
65
    public function offsetUnset(mixed $offset): void
66
    {
67
        unset($this->items[$offset]);
68
    }
69
70
    public function jsonSerialize(): mixed
71
    {
72
        return $this->items;
73
    }
74
}
75