Completed
Pull Request — master (#183)
by Danny
05:29
created

ScopePointer::isFunction()   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
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA;
7
8
use PHPSA\Definition\ClassMethod;
9
use PHPSA\Definition\FunctionDefinition;
10
11
class ScopePointer
12
{
13
    /**
14
     * @var ClassMethod|FunctionDefinition
15
     */
16
    protected $object;
17
18
    /**
19
     * Initializes the scopePointer with an object
20
     *
21
     * @param $object
22
     */
23 27
    public function __construct($object)
24
    {
25 27
        $this->object = $object;
26 27
    }
27
28
    /**
29
     * Is the object a class method?
30
     *
31
     * @return bool
32
     */
33 27
    public function isClassMethod()
34
    {
35 27
        return $this->object instanceof ClassMethod;
36
    }
37
38
    /**
39
     * Is the object a function?
40
     *
41
     * @return bool
42
     */
43 6
    public function isFunction()
44
    {
45 6
        return $this->object instanceof FunctionDefinition;
46
    }
47
48
    /**
49
     * Returns the object.
50
     *
51
     * @return ClassMethod|FunctionDefinition
52
     */
53 23
    public function getObject()
54
    {
55 23
        return $this->object;
56
    }
57
}
58