| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file is part of the Peast package |
| 4 |
* |
| 5 |
* (c) Marco Marchiò <[email protected]> |
| 6 |
* |
| 7 |
* For the full copyright and license information refer to the LICENSE file |
| 8 |
* distributed with this source code |
| 9 |
*/ |
| 10 |
namespace Peast\Syntax\Node; |
| 11 |
|
| 12 |
/** |
| 13 |
* A node that represents a call expression. |
| 14 |
* For example: test() |
| 15 |
* |
| 16 |
* @author Marco Marchiò <[email protected]> |
| 17 |
*/ |
| 18 |
class CallExpression extends ChainElement |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Map of node properties |
| 22 |
* |
| 23 |
* @var array |
| 24 |
*/ |
| 25 |
protected $propertiesMap = array( |
| 26 |
"callee" => true, |
| 27 |
"arguments" => true |
| 28 |
); |
| 29 |
|
| 30 |
/** |
| 31 |
* The callee expression |
| 32 |
* |
| 33 |
* @var Expression|Super |
| 34 |
*/ |
| 35 |
protected $callee; |
| 36 |
|
| 37 |
/** |
| 38 |
* The arguments array |
| 39 |
* |
| 40 |
* @var Expression[]|SpreadElement[] |
| 41 |
*/ |
| 42 |
protected $arguments = array(); |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns the callee expression |
| 46 |
* |
| 47 |
* @return Expression|Super |
| 48 |
*/ |
| 49 |
public function getCallee() |
| 50 |
{ |
| 51 |
return $this->callee; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Sets the callee expression |
| 56 |
* |
| 57 |
* @param Expression|Super $callee Callee expression |
| 58 |
* |
| 59 |
* @return $this |
| 60 |
*/ |
| 61 |
public function setCallee($callee) |
| 62 |
{ |
| 63 |
$this->assertType($callee, array("Expression", "Super")); |
| 64 |
$this->callee = $callee; |
| 65 |
return $this; |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Returns the arguments array |
| 70 |
* |
| 71 |
* @return Expression[]|SpreadElement[] |
| 72 |
*/ |
| 73 |
public function getArguments() |
| 74 |
{ |
| 75 |
return $this->arguments; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Sets the arguments array |
| 80 |
* |
| 81 |
* @param Expression[]|SpreadElement[] $arguments Arguments array |
| 82 |
* |
| 83 |
* @return $this |
| 84 |
*/ |
| 85 |
public function setArguments($arguments) |
| 86 |
{ |
| 87 |
$this->assertArrayOf($arguments, array("Expression", "SpreadElement")); |
| 88 |
$this->arguments = $arguments; |
| 89 |
return $this; |
| 90 |
} |
| 91 |
} |