Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/JSX/JSXOpeningElement.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 /**
13 * A node that represents a JSX opening element tag.
14 *
15 * @author Marco Marchiò <[email protected]>
16 */
17 class JSXOpeningElement extends JSXBoundaryElement
18 {
19 /**
20 * Map of node properties
21 *
22 * @var array
23 */
24 protected $propertiesMap = array(
25 "attributes" => true,
26 "selfClosing" => false
27 );
28
29 /**
30 * Children nodes array
31 *
32 * @var JSXAttribute[]|JSXSpreadAttribute[]
33 */
34 protected $attributes = array();
35
36 /**
37 * Self closing tag mode
38 *
39 * @var bool
40 */
41 protected $selfClosing = false;
42
43 /**
44 * Returns the children attributes array
45 *
46 * @return JSXAttribute[]|JSXSpreadAttribute[]
47 */
48 public function getAttributes()
49 {
50 return $this->attributes;
51 }
52
53 /**
54 * Sets the attributes nodes array
55 *
56 * @param JSXAttribute[]|JSXSpreadAttribute[] $attributes Attributes nodes
57 * array
58 *
59 * @return $this
60 */
61 public function setAttributes($attributes)
62 {
63 $this->assertArrayOf($attributes, array(
64 "JSX\\JSXAttribute", "JSX\\JSXSpreadAttribute"
65 ));
66 $this->attributes = $attributes;
67 return $this;
68 }
69
70 /**
71 * Returns the self closing tag mode
72 *
73 * @return bool
74 */
75 public function getSelfClosing()
76 {
77 return $this->selfClosing;
78 }
79
80 /**
81 * Sets the self closing tag mode
82 *
83 * @param bool $selfClosing Self closing tag mode
84 *
85 * @return $this
86 */
87 public function setSelfClosing($selfClosing)
88 {
89 $this->selfClosing = (bool) $selfClosing;
90 return $this;
91 }
92 }