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

BindingsBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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