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 ( ac587f...53bcfa )
by SignpostMarv
07:07
created

DaftObjectIdValuesHash()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
cc 4
eloc 11
nc 6
nop 1
dl 0
loc 20
ccs 0
cts 16
cp 0
crap 20
rs 9.2
c 0
b 0
f 0
1
<?php
2
/**
3
* Base daft objects.
4
*
5
* @author SignpostMarv
6
*/
7
declare(strict_types=1);
8
9
namespace SignpostMarv\DaftObject;
10
11
trait DaftObjectIdValuesHashLazyInt
12
{
13
    /**
14
    * @see DefinesOwnIdPropertiesInterface::DaftObjectIdHash()
15
    */
16
    public static function DaftObjectIdHash(DefinesOwnIdPropertiesInterface $object) : string
17
    {
18
        $id = [];
19
20
        foreach ($object::DaftObjectIdProperties() as $prop) {
21
            $id[] = $object->$prop;
22
        }
23
24
        return static::DaftObjectIdValuesHash($id);
25
    }
26
27
    /**
28
    * @see DefinesOwnIdPropertiesInterface::DaftObjectIdValuesHash()
29
    */
30
    public static function DaftObjectIdValuesHash(array $id) : string
31
    {
32
        static $ids = [];
33
34
        $className = static::class;
35
36
        $objectIds = '';
37
        foreach (array_values($id) as $i => $idVal) {
38
            if ($i >= 1) {
39
                $objectIds .= '::';
40
            }
41
            $objectIds .= (string) $idVal;
42
        }
43
44
        if (false === isset($ids[$className], $ids[$className][$objectIds])) {
45
            $ids[$className] = $ids[$className] ?? [];
46
            $ids[$className][$objectIds] = (string) count($ids[$className]);
47
        }
48
49
        return $ids[$className][$objectIds];
50
    }
51
}
52