Completed
Push — develop ( 4fc097...cb6ec7 )
by Jaap
01:50
created

Function_::getLocation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2010-2015 Mike van Riel<[email protected]>
9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link      http://phpdoc.org
11
 */
12
13
namespace phpDocumentor\Reflection\Php;
14
15
use phpDocumentor\Reflection\DocBlock;
16
use phpDocumentor\Reflection\Element;
17
use phpDocumentor\Reflection\Fqsen;
18
use phpDocumentor\Reflection\Location;
19
20
/**
21
 * Descriptor representing a function
22
 */
23
// @codingStandardsIgnoreStart
24
final class Function_ implements Element
25
// // @codingStandardsIgnoreEnd
26
{
27
    /**
28
     * @var Fqsen Full Qualified Structural Element Name
29
     */
30
    private $fqsen;
31
32
    /** @var Argument[] $arguments */
33
    private $arguments = array();
34
35
    /**
36
     * @var DocBlock|null
37
     */
38
    private $docBlock;
39
40
    /**
41
     * @var Location
42
     */
43
    private $location;
44
45 3
    /**
46
     * Initializes the object.
47 3
     *
48 3
     * @param Fqsen $fqsen
49 3
     * @param DocBlock|null $docBlock
50
     */
51
    public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null)
52
    {
53
        if ($location === null) {
54
            $location = new Location(-1);
55
        }
56 1
57
        $this->fqsen = $fqsen;
58 1
        $this->docBlock = $docBlock;
59
        $this->location = $location;
60
    }
61
62
    /**
63
     * Returns the arguments of this function.
64
     *
65
     * @return Argument[]
66 1
     */
67
    public function getArguments()
68 1
    {
69 1
        return $this->arguments;
70
    }
71
72
    /**
73
     * Add an argument to the function.
74
     *
75
     * @param Argument $argument
76 1
     */
77
    public function addArgument(Argument $argument)
78 1
    {
79
        $this->arguments[] = $argument;
80
    }
81
82
    /**
83
     * Returns the Fqsen of the element.
84
     *
85
     * @return Fqsen
86 1
     */
87
    public function getFqsen()
88 1
    {
89
        return $this->fqsen;
90
    }
91
92
    /**
93
     * Returns the name of the element.
94
     *
95
     * @return string
96 1
     */
97
    public function getName()
98 1
    {
99
        return $this->fqsen->getName();
100
    }
101
102
    /**
103
     * Returns the DocBlock of the element if available
104
     *
105
     * @return null|DocBlock
106
     */
107
    public function getDocBlock()
108
    {
109
        return $this->docBlock;
110
    }
111
112
    /**
113
     * @return Location
114
     */
115
    public function getLocation()
116
    {
117
        return $this->location;
118
    }
119
}
120