| 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 key value pair for an import attribute. |
| 14 |
* For example: return a + 1 |
| 15 |
* |
| 16 |
* @author Marco Marchiò <[email protected]> |
| 17 |
*/ |
| 18 |
class ImportAttribute extends Node |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Map of node properties |
| 22 |
* |
| 23 |
* @var array |
| 24 |
*/ |
| 25 |
protected $propertiesMap = array( |
| 26 |
"key" => true, |
| 27 |
"value" => true |
| 28 |
); |
| 29 |
|
| 30 |
/** |
| 31 |
* Import attribute key |
| 32 |
* |
| 33 |
* @var Identifier|Literal |
| 34 |
*/ |
| 35 |
protected $key; |
| 36 |
|
| 37 |
/** |
| 38 |
* Import attribute value |
| 39 |
* |
| 40 |
* @var Literal |
| 41 |
*/ |
| 42 |
protected $value; |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns the import attribute key |
| 46 |
* |
| 47 |
* @return Identifier|Literal |
| 48 |
*/ |
| 49 |
public function getKey() |
| 50 |
{ |
| 51 |
return $this->key; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Sets the import attribute key |
| 56 |
* |
| 57 |
* @param Identifier|Literal $key The import attribute key |
| 58 |
* |
| 59 |
* @return $this |
| 60 |
*/ |
| 61 |
public function setKey($key) |
| 62 |
{ |
| 63 |
$this->assertType($key, array("Identifier", "Literal")); |
| 64 |
$this->key = $key; |
| 65 |
return $this; |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Returns the import attribute value |
| 70 |
* |
| 71 |
* @return Literal |
| 72 |
*/ |
| 73 |
public function getValue() |
| 74 |
{ |
| 75 |
return $this->value; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Sets the import attribute value |
| 80 |
* |
| 81 |
* @param Literal $value The import attribute value |
| 82 |
* |
| 83 |
* @return $this |
| 84 |
*/ |
| 85 |
public function setValue(Literal $value) |
| 86 |
{ |
| 87 |
$this->value = $value; |
| 88 |
return $this; |
| 89 |
} |
| 90 |
} |