Passed
Push — master ( 21d927...ee3ef8 )
by Php Easy Api
03:01
created

RequestAnnotationAbstract::setReflection()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Request;
4
5
use Resta\Support\ClosureDispatcher;
6
use Resta\Foundation\ApplicationProvider;
7
8
abstract class RequestAnnotationAbstract extends ApplicationProvider
9
{
10
    /**
11
     * @var string $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
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);
0 ignored issues
show
Documentation Bug introduced by
It seems like Resta\Support\ClosureDispatcher::bind($reflection) of type Resta\Support\ClosureDispatcher is incompatible with the declared type string of property $request.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
58
    }
59
}