EndPoint::setArgs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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