Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/JSX/JSXFragment.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\JSX;
11
12 use Peast\Syntax\Node\Node;
13 use Peast\Syntax\Node\Expression;
14
15 /**
16 * A node that represents a JSX fragment.
17 *
18 * @author Marco Marchiò <[email protected]>
19 */
20 class JSXFragment extends Node implements Expression
21 {
22 /**
23 * Map of node properties
24 *
25 * @var array
26 */
27 protected $propertiesMap = array(
28 "openingFragment" => true,
29 "children" => true,
30 "closingFragment" => true
31 );
32
33 /**
34 * Opening fragment node
35 *
36 * @var JSXOpeningFragment
37 */
38 protected $openingFragment;
39
40 /**
41 * Children nodes array
42 *
43 * @var Node[]
44 */
45 protected $children = array();
46
47 /**
48 * Closing fragment node
49 *
50 * @var JSXClosingFragment
51 */
52 protected $closingFragment;
53
54 /**
55 * Returns the opening fragment node
56 *
57 * @return JSXOpeningFragment
58 */
59 public function getOpeningFragment()
60 {
61 return $this->openingFragment;
62 }
63
64 /**
65 * Sets the opening fragment node
66 *
67 * @param JSXOpeningFragment $openingFragment Opening fragment node
68 *
69 * @return $this
70 */
71 public function setOpeningFragment(JSXOpeningFragment $openingFragment)
72 {
73 $this->openingFragment = $openingFragment;
74 return $this;
75 }
76
77 /**
78 * Returns the children nodes array
79 *
80 * @return Node[]
81 */
82 public function getChildren()
83 {
84 return $this->children;
85 }
86
87 /**
88 * Sets the children nodes array
89 *
90 * @param Node[] $children Children nodes array
91 *
92 * @return $this
93 */
94 public function setChildren($children)
95 {
96 $this->assertArrayOf($children, array(
97 "JSX\\JSXText", "JSX\\JSXExpressionContainer", "JSX\\JSXSpreadChild",
98 "JSX\\JSXElement", "JSX\\JSXFragment"
99 ));
100 $this->children = $children;
101 return $this;
102 }
103
104 /**
105 * Returns the closing fragment node
106 *
107 * @return JSXClosingFragment
108 */
109 public function getClosingFragment()
110 {
111 return $this->closingFragment;
112 }
113
114 /**
115 * Sets the closing fragment node
116 *
117 * @param JSXClosingFragment $closingFragment Closing fragment node
118 *
119 * @return $this
120 */
121 public function setClosingFragment(JSXClosingFragment $closingFragment)
122 {
123 $this->closingFragment = $closingFragment;
124 return $this;
125 }
126 }