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

ScopePointer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isClassMethod() 0 4 1
A getObject() 0 4 1
A isFunction() 0 4 1
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