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

Handlers   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllHandlers() 0 3 1
A handle() 0 4 1
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