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
Pull Request — master (#79)
by Sid
01:09
created

DTOCache   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
3
namespace Spatie\DataTransferObject;
4
5
use Closure;
6
7
class DTOCache
8
{
9
    /** @var array */
10
    private static $cache = [];
11
12
    public static function resolve(string $class, Closure $closure): array
13
    {
14
        if (! isset(self::$cache[$class])) {
15
            self::$cache[$class] = $closure();
16
        }
17
18
        return self::$cache[$class];
19
    }
20
}
21