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 ( 9e88df...116f4d )
by SignpostMarv
01:54
created

DaftObjectIdValuesHashLazyInt::DaftObjectIdHash()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
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 2
    public static function DaftObjectIdHash(
17
        DefinesOwnIdPropertiesInterface $object
18
    ) : string {
19 2
        $id = [];
20
21 2
        foreach ($object::DaftObjectIdProperties() as $prop) {
22 2
            $id[] = $object->$prop;
23
        }
24
25 2
        return static::DaftObjectIdValuesHash($id);
26
    }
27
28
    /**
29
    * @see DefinesOwnIdPropertiesInterface::DaftObjectIdValuesHash()
30
    */
31 2
    public static function DaftObjectIdValuesHash(array $id) : string
32
    {
33 2
        static $ids = [];
34
35 2
        $className = static::class;
36
37 2
        $objectIds = '';
38 2
        foreach (array_values($id) as $i => $idVal) {
39 2
            if ($i >= 1) {
40 1
                $objectIds .= '::';
41
            }
42 2
            $objectIds .= (string) $idVal;
43
        }
44
45 2
        if (false === isset($ids[$className], $ids[$className][$objectIds])) {
46 2
            $ids[$className] = $ids[$className] ?? [];
47 2
            $ids[$className][$objectIds] = (string) count($ids[$className]);
48
        }
49
50 2
        return $ids[$className][$objectIds];
51
    }
52
}
53