| 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 yield statement. |
| 14 |
* |
| 15 |
* @author Marco Marchiò <[email protected]> |
| 16 |
*/ |
| 17 |
class YieldExpression extends Node implements Expression |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Map of node properties |
| 21 |
* |
| 22 |
* @var array |
| 23 |
*/ |
| 24 |
protected $propertiesMap = array( |
| 25 |
"argument" => true, |
| 26 |
"delegate" => false |
| 27 |
); |
| 28 |
|
| 29 |
/** |
| 30 |
* Yield argument |
| 31 |
* |
| 32 |
* @var Expression |
| 33 |
*/ |
| 34 |
protected $argument; |
| 35 |
|
| 36 |
/** |
| 37 |
* Delegate flag that is true when the yield keyword is preceded by * |
| 38 |
* |
| 39 |
* @var bool |
| 40 |
*/ |
| 41 |
protected $delegate = false; |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns yield argument |
| 45 |
* |
| 46 |
* @return Expression |
| 47 |
*/ |
| 48 |
public function getArgument() |
| 49 |
{ |
| 50 |
return $this->argument; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Sets yield argument |
| 55 |
* |
| 56 |
* @param Expression $argument Argument |
| 57 |
* |
| 58 |
* @return $this |
| 59 |
*/ |
| 60 |
public function setArgument($argument) |
| 61 |
{ |
| 62 |
$this->assertType($argument, "Expression", true); |
| 63 |
$this->argument = $argument; |
| 64 |
return $this; |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Returns the delegate flag that is true when the yield keyword is |
| 69 |
* preceded by * |
| 70 |
* |
| 71 |
* @return bool |
| 72 |
*/ |
| 73 |
public function getDelegate() |
| 74 |
{ |
| 75 |
return $this->delegate; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Sets the delegate flag that is true when the yield keyword is |
| 80 |
* preceded by * |
| 81 |
* |
| 82 |
* @param bool $delegate Delegate flag |
| 83 |
* |
| 84 |
* @return $this |
| 85 |
*/ |
| 86 |
public function setDelegate($delegate) |
| 87 |
{ |
| 88 |
$this->delegate = (bool) $delegate; |
| 89 |
return $this; |
| 90 |
} |
| 91 |
} |