| 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 an "export all" declaration. |
| 14 |
* For example: export * from "test" |
| 15 |
* |
| 16 |
* @author Marco Marchiò <[email protected]> |
| 17 |
*/ |
| 18 |
class ExportAllDeclaration extends Node implements ModuleDeclaration |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Map of node properties |
| 22 |
* |
| 23 |
* @var array |
| 24 |
*/ |
| 25 |
protected $propertiesMap = array( |
| 26 |
"source" => true, |
| 27 |
"exported" => true, |
| 28 |
"attributes" => true |
| 29 |
); |
| 30 |
|
| 31 |
/** |
| 32 |
* The export source |
| 33 |
* |
| 34 |
* @var Literal |
| 35 |
*/ |
| 36 |
protected $source; |
| 37 |
|
| 38 |
/** |
| 39 |
* The exported name |
| 40 |
* |
| 41 |
* @var Identifier|StringLiteral |
| 42 |
*/ |
| 43 |
protected $exported; |
| 44 |
|
| 45 |
/** |
| 46 |
* Attributes array |
| 47 |
* |
| 48 |
* @var array |
| 49 |
*/ |
| 50 |
protected $attributes = array(); |
| 51 |
|
| 52 |
/** |
| 53 |
* Returns the export source |
| 54 |
* |
| 55 |
* @return Literal |
| 56 |
*/ |
| 57 |
public function getSource() |
| 58 |
{ |
| 59 |
return $this->source; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Sets the export source |
| 64 |
* |
| 65 |
* @param Literal $source Export source |
| 66 |
* |
| 67 |
* @return $this |
| 68 |
*/ |
| 69 |
public function setSource(Literal $source) |
| 70 |
{ |
| 71 |
$this->source = $source; |
| 72 |
return $this; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Returns the exported name |
| 77 |
* |
| 78 |
* @return Identifier|StringLiteral |
| 79 |
*/ |
| 80 |
public function getExported() |
| 81 |
{ |
| 82 |
return $this->exported; |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Sets the exported name |
| 87 |
*W |
| 88 |
* @param Identifier|StringLiteral $exported Exported name |
| 89 |
* |
| 90 |
* @return $this |
| 91 |
*/ |
| 92 |
public function setExported($exported) |
| 93 |
{ |
| 94 |
$this->assertType($exported, array("Identifier", "StringLiteral"), true); |
| 95 |
$this->exported = $exported; |
| 96 |
return $this; |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Returns the attributes array |
| 101 |
* |
| 102 |
* @return array |
| 103 |
*/ |
| 104 |
public function getAttributes() |
| 105 |
{ |
| 106 |
return $this->attributes; |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Sets the attributes array |
| 111 |
* |
| 112 |
* @param array $attributes Attributes array |
| 113 |
* |
| 114 |
* @return $this |
| 115 |
*/ |
| 116 |
public function setAttributes($attributes) |
| 117 |
{ |
| 118 |
$this->assertArrayOf($attributes, "ImportAttribute"); |
| 119 |
$this->attributes = $attributes; |
| 120 |
return $this; |
| 121 |
} |
| 122 |
} |