Passed
Push — bugfix/support-windows ( 0e99e7...b5ecf8 )
by Jesús
06:33 queued 02:55
created

BindingsBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

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