Test Setup Failed
Push — master ( 29d7f6...b0c19c )
by Php Easy Api
03:16
created

ClientAnnotationAbstract::getInputs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Client;
4
5
use Resta\Support\ClosureDispatcher;
6
use Resta\Foundation\ApplicationProvider;
7
8
abstract class ClientAnnotationAbstract extends ApplicationProvider
9
{
10
    /**
11
     * @var object $request
12
     */
13
    protected $request;
14
15
    /**
16
     * @var array $inputs
17
     */
18
    protected $inputs = [];
19
20
    /**
21
     * @param $method
22
     * @param $key
23
     * @return mixed
24
     */
25
    abstract function annotation($method,$key);
26
27
    /**
28
     * get input values from request object
29
     *
30
     * @return mixed|void
31
     */
32
    public function getInputs()
33
    {
34
        $this->inputs = $this->getReflection('inputs');
35
    }
36
37
    /**
38
     * get reflection from request object
39
     *
40
     * @param $param
41
     * @return mixed
42
     */
43
    public function getReflection($param)
44
    {
45
        return $this->request->call(function() use ($param) {
46
            return $this->{$param};
47
        });
48
    }
49
50
    /**
51
     * set reflection for request object
52
     *
53
     * @param $reflection
54
     */
55
    public function setReflection($reflection){
56
57
        $this->request = ClosureDispatcher::bind($reflection);
58
    }
59
}