Passed
Push — main ( ae7e9f...55fc6d )
by
unknown
01:00 queued 14s
created

Handlers::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Router;
6
7
final class Handlers
8
{
9
    /** @var array<class-string, callable> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string, callable> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string, callable>.
Loading history...
10
    private array $handlers = [];
11
12
    /**
13
     * @param class-string $exception
14
     */
15 1
    public function handle(string $exception, callable $handler): self
16
    {
17 1
        $this->handlers[$exception] = $handler;
18 1
        return $this;
19
    }
20
21
    /**
22
     * @return array<class-string, callable>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string, callable> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string, callable>.
Loading history...
23
     */
24 2
    public function getAllHandlers(): array
25
    {
26 2
        return $this->handlers;
27
    }
28
}
29