1 | <?php |
||
8 | class Function_ extends Node\Stmt implements FunctionLike |
||
9 | { |
||
10 | /** @var bool Whether function returns by reference */ |
||
11 | public $byRef; |
||
12 | /** @var string Name */ |
||
13 | public $name; |
||
14 | /** @var Node\Param[] Parameters */ |
||
15 | public $params; |
||
16 | /** @var null|string|Node\Name Return type */ |
||
17 | public $returnType; |
||
18 | /** @var Node[] Statements */ |
||
19 | public $stmts; |
||
20 | |||
21 | /** |
||
22 | * Constructs a function node. |
||
23 | * |
||
24 | * @param string $name Name |
||
25 | * @param array $subNodes Array of the following optional subnodes: |
||
26 | * 'byRef' => false : Whether to return by reference |
||
27 | * 'params' => array(): Parameters |
||
28 | * 'returnType' => null : Return type |
||
29 | * 'stmts' => array(): Statements |
||
30 | * @param array $attributes Additional attributes |
||
31 | */ |
||
32 | public function __construct($name, array $subNodes = array(), array $attributes = array()) { |
||
33 | parent::__construct($attributes); |
||
34 | $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; |
||
35 | $this->name = $name; |
||
36 | $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); |
||
37 | $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; |
||
38 | $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); |
||
39 | } |
||
40 | |||
41 | public function getSubNodeNames() { |
||
44 | |||
45 | public function returnsByRef() { |
||
48 | |||
49 | public function getParams() { |
||
52 | |||
53 | public function getReturnType() { |
||
56 | |||
57 | public function getStmts() { |
||
60 | } |
||
61 |