2011-05-27 18:20:44 +02:00
|
|
|
<?php
|
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
namespace PhpParser\Node\Stmt;
|
|
|
|
|
|
|
|
use PhpParser\Node;
|
|
|
|
|
2011-05-27 18:20:44 +02:00
|
|
|
/**
|
2014-02-06 14:44:16 +01:00
|
|
|
* @property bool $byRef Whether returns by reference
|
|
|
|
* @property string $name Name
|
|
|
|
* @property Node\Param[] $params Parameters
|
|
|
|
* @property Node[] $stmts Statements
|
2011-05-27 18:20:44 +02:00
|
|
|
*/
|
2014-02-06 14:44:16 +01:00
|
|
|
class Function_ extends Node\Stmt
|
2011-05-27 18:20:44 +02:00
|
|
|
{
|
2011-10-28 19:06:24 +02:00
|
|
|
/**
|
|
|
|
* Constructs a function node.
|
|
|
|
*
|
2012-04-29 23:32:09 +02:00
|
|
|
* @param string $name Name
|
|
|
|
* @param array $subNodes Array of the following optional subnodes:
|
|
|
|
* 'byRef' => false : Whether to return by reference
|
|
|
|
* 'params' => array(): Parameters
|
|
|
|
* 'stmts' => array(): Statements
|
|
|
|
* @param array $attributes Additional attributes
|
2011-10-28 19:06:24 +02:00
|
|
|
*/
|
2012-04-29 23:32:09 +02:00
|
|
|
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
|
2011-10-28 19:06:24 +02:00
|
|
|
parent::__construct(
|
2014-03-22 14:49:56 +01:00
|
|
|
array(
|
|
|
|
'byRef' => isset($subNodes['byRef']) ? $subNodes['byRef'] : false,
|
|
|
|
'name' => $name,
|
|
|
|
'params' => isset($subNodes['params']) ? $subNodes['params'] : array(),
|
|
|
|
'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array(),
|
2011-10-28 19:06:24 +02:00
|
|
|
),
|
2012-04-29 23:32:09 +02:00
|
|
|
$attributes
|
2011-10-28 19:06:24 +02:00
|
|
|
);
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
2011-05-27 18:20:44 +02:00
|
|
|
}
|