Passed
Push — main ( 5b3d5b...c3557b )
by
unknown
54s queued 12s
created

MappingInterfaces   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 21
rs 10
ccs 5
cts 5
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 3 1
A add() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Router;
6
7
final class MappingInterfaces
8
{
9
    /** @var array<class-string, callable|class-string|object> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string, callable|class-string|object> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string, callable|class-string|object>.
Loading history...
10
    private array $mappingInterfaces = [];
11
12
    /**
13
     * @param class-string $name
14
     * @param callable|class-string|object $instance
15
     */
16 1
    public function add(string $name, mixed $instance): self
17
    {
18 1
        $this->mappingInterfaces[$name] = $instance;
19 1
        return $this;
20
    }
21
22
    /**
23
     * @return array<class-string, callable|class-string|object>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string, callable|class-string|object> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string, callable|class-string|object>.
Loading history...
24
     */
25 50
    public function getAll(): array
26
    {
27 50
        return $this->mappingInterfaces;
28
    }
29
}
30