EndPoint   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __invoke() 0 4 1
A setArgs() 0 5 1
A getArgs() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace PTS\Routing;
5
6
class EndPoint
7
{
8
    /** @var callable */
9
    protected $handler;
10
    /** @var array */
11
    protected $args = [];
12
13 31
    public function __construct(callable $handler, array $args = [])
14
    {
15 31
        $this->handler = $handler;
16 31
        $this->args = $args;
17 31
    }
18
19 8
    public function __invoke()
20
    {
21 8
        return \call_user_func_array($this->handler, $this->args);
22
    }
23
24 2
    public function setArgs(array $args = []): self
25
    {
26 2
        $this->args = $args;
27 2
        return $this;
28
    }
29
30 1
    public function getArgs(): array
31
    {
32 1
        return $this->args;
33
    }
34
}
35