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 ( de8df8...cc25ac )
by Baptiste
03:22
created

ConstructorLessInstanciator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 22
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 8 2
A parameters() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Reflection\Instanciator;
5
6
use Innmind\Reflection\{
7
    Instanciator,
8
    Exception\InstanciationFailed,
9
};
10
use Innmind\Immutable\{
11
    MapInterface,
12
    SetInterface,
13
    Map,
14
    Set,
15
};
16
17
final class ConstructorLessInstanciator implements Instanciator
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 1
    public function build(string $class, MapInterface $properties): object
23
    {
24
        try {
25 1
            $refl = new \ReflectionClass($class);
26
27 1
            return $refl->newInstanceWithoutConstructor();
28
        } catch (\TypeError $e) {
29
            throw new InstanciationFailed($class, $e);
30
        }
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function parameters(string $class): SetInterface
37
    {
38 1
        return new Set('string');
39
    }
40
}
41