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 ( 24cf7f...e82961 )
by SignpostMarv
03:18
created

DaftObjectIdValuesHash()   B

Complexity

Conditions 5
Paths 12

Size

Total Lines 24
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 13
cts 13
cp 1
rs 8.5125
c 0
b 0
f 0
cc 5
eloc 13
nc 12
nop 1
crap 5
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
        if (isset($ids[$className]) === false) {
38 2
            $ids[$className] = [];
39
        }
40
41 2
        $objectIds = '';
42 2
        foreach (array_values($id) as $i => $idVal) {
43 2
            if ($i >= 1) {
44 1
                $objectIds .= '::';
45
            }
46 2
            $objectIds .= (string) $idVal;
47
        }
48
49 2
        if (isset($ids[$className][$objectIds]) === false) {
50 2
            $ids[$className][$objectIds] = (string) count($ids[$className]);
51
        }
52
53 2
        return $ids[$className][$objectIds];
54
    }
55
}
56