Completed
Push — master ( 8801ad...e19554 )
by Alexpts
02:50
created

EndPoint::getArgs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types = 1);
3
namespace PTS\Routing;
4
5
class EndPoint
6
{
7
    /** @var callable */
8
    protected $handler;
9
    /** @var array */
10
    protected $args = [];
11
12
13
    public function __construct(callable $handler, array $args = [])
14
    {
15
        $this->handler = $handler;
16
        $this->args = $args;
17
    }
18
19
    public function __invoke()
20
    {
21
        return call_user_func_array($this->handler, $this->args);
22
    }
23
24
    public function setArgs(array $args = [])
25
    {
26
        $this->args = $args;
27
        return $this;
28
    }
29
30
    public function getArgs() : array
31
    {
32
        return $this->args;
33
    }
34
}
35