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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 40
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A DaftObjectIdHash() 0 10 2
A DaftObjectIdValuesHash() 0 20 4
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