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 ( f6d2fd...389e43 )
by Freek
01:51
created

Backtrace   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getArguments() 0 4 1
A getFunctionName() 0 4 1
A getObject() 0 4 1
A getHash() 0 8 2
1
<?php
2
3
namespace Spatie\Once;
4
5
class Backtrace
6
{
7
    /** @var array */
8
    public $trace;
9
10
    public function __construct(array $trace)
11
    {
12
        $this->trace = $trace;
13
    }
14
15
    public function getArguments(): array
16
    {
17
        return $this->trace['args'];
18
    }
19
20
    public function getFunctionName(): string
21
    {
22
        return $this->trace['function'];
23
    }
24
25
    /**
26
     * @return mixed
27
     */
28
    public function getObject()
29
    {
30
        return $this->trace['object'];
31
    }
32
33
    public function getHash(): string
34
    {
35
        $normalizedArguments = array_map(function ($argument) {
36
            return is_object($argument) ? spl_object_hash($argument) : $argument;
37
        }, $this->getArguments());
38
39
        return md5($this->getFunctionName() . serialize($normalizedArguments));
40
    }
41
}
42