Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/ImportDeclaration.php

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