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.
Completed
Push — master ( 340627...c6d03b )
by Ema
05:56 queued 04:30
created

ModelCollectionOrdered::getOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Pnz\MattermostClient\Model;
6
7
abstract class ModelCollectionOrdered extends ModelCollection
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $order = [];
13
14
    /**
15
     * {@inheritdoc}
16
     */
17 2
    public static function createFromArray(array $data)
18
    {
19 2
        $collection = new static();
20
21 2
        foreach ($data[static::getItemsDataName()] as $itemId => $itemData) {
22 2
            $collection->items[$itemId] = $collection->createItem($itemData);
23
        }
24 2
        $collection->order = $data['order'];
25
26 2
        return $collection;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 2
    public function current()
33
    {
34 2
        return $this->items[$this->order[$this->key]];
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 2
    public function key()
41
    {
42 2
        return $this->order[$this->key];
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 2
    public function valid()
49
    {
50 2
        return $this->key < count($this->order);
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56 2
    public function getOrder(): array
57
    {
58 2
        return $this->order;
59
    }
60
61
    /**
62
     * Returns the name of the data containing the items to be sorted.
63
     *
64
     * @return string
65
     */
66
    abstract protected static function getItemsDataName();
67
}
68