Passed
Branch master (701f59)
by Alexpts
02:08
created

EndPoint::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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 30
    public function __construct(callable $handler, array $args = [])
14
    {
15 30
        $this->handler = $handler;
16 30
        $this->args = $args;
17 30
    }
18
19 7
    public function __invoke()
20
    {
21 7
        return call_user_func_array($this->handler, $this->args);
22
    }
23
24 2
    public function setArgs(array $args = [])
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