-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathAXNode.php
More file actions
181 lines (166 loc) · 3.72 KB
/
AXNode.php
File metadata and controls
181 lines (166 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
namespace ChromeDevtoolsProtocol\Model\Accessibility;
/**
* A node in the accessibility tree.
*
* @generated This file has been auto-generated, do not edit.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
final class AXNode implements \JsonSerializable
{
/**
* Unique identifier for this node.
*
* @var string
*/
public $nodeId;
/**
* Whether this node is ignored for accessibility
*
* @var bool
*/
public $ignored;
/**
* Collection of reasons why this node is hidden.
*
* @var AXProperty[]|null
*/
public $ignoredReasons;
/**
* This `Node`'s role, whether explicit or implicit.
*
* @var AXValue|null
*/
public $role;
/**
* The accessible name for this `Node`.
*
* @var AXValue|null
*/
public $name;
/**
* The accessible description for this `Node`.
*
* @var AXValue|null
*/
public $description;
/**
* The value for this `Node`.
*
* @var AXValue|null
*/
public $value;
/**
* All other properties
*
* @var AXProperty[]|null
*/
public $properties;
/**
* IDs for each of this node's child nodes.
*
* @var string[]|null
*/
public $childIds;
/**
* The backend ID for the associated DOM node, if any.
*
* @var int
*/
public $backendDOMNodeId;
public static function fromJson($data)
{
$instance = new static();
if (isset($data->nodeId)) {
$instance->nodeId = (string)$data->nodeId;
}
if (isset($data->ignored)) {
$instance->ignored = (bool)$data->ignored;
}
if (isset($data->ignoredReasons)) {
$instance->ignoredReasons = [];
foreach ($data->ignoredReasons as $item) {
$instance->ignoredReasons[] = AXProperty::fromJson($item);
}
}
if (isset($data->role)) {
$instance->role = AXValue::fromJson($data->role);
}
if (isset($data->name)) {
$instance->name = AXValue::fromJson($data->name);
}
if (isset($data->description)) {
$instance->description = AXValue::fromJson($data->description);
}
if (isset($data->value)) {
$instance->value = AXValue::fromJson($data->value);
}
if (isset($data->properties)) {
$instance->properties = [];
foreach ($data->properties as $item) {
$instance->properties[] = AXProperty::fromJson($item);
}
}
if (isset($data->childIds)) {
$instance->childIds = [];
if (isset($data->childIds)) {
$instance->childIds = [];
foreach ($data->childIds as $item) {
$instance->childIds[] = (string)$item;
}
}
}
if (isset($data->backendDOMNodeId)) {
$instance->backendDOMNodeId = (int)$data->backendDOMNodeId;
}
return $instance;
}
public function jsonSerialize(): mixed
{
$data = new \stdClass();
if ($this->nodeId !== null) {
$data->nodeId = $this->nodeId;
}
if ($this->ignored !== null) {
$data->ignored = $this->ignored;
}
if ($this->ignoredReasons !== null) {
$data->ignoredReasons = [];
foreach ($this->ignoredReasons as $item) {
$data->ignoredReasons[] = $item->jsonSerialize();
}
}
if ($this->role !== null) {
$data->role = $this->role->jsonSerialize();
}
if ($this->name !== null) {
$data->name = $this->name->jsonSerialize();
}
if ($this->description !== null) {
$data->description = $this->description->jsonSerialize();
}
if ($this->value !== null) {
$data->value = $this->value->jsonSerialize();
}
if ($this->properties !== null) {
$data->properties = [];
foreach ($this->properties as $item) {
$data->properties[] = $item->jsonSerialize();
}
}
if ($this->childIds !== null) {
$data->childIds = [];
if ($this->childIds !== null) {
$data->childIds = [];
foreach ($this->childIds as $item) {
$data->childIds[] = $item;
}
}
}
if ($this->backendDOMNodeId !== null) {
$data->backendDOMNodeId = $this->backendDOMNodeId;
}
return $data;
}
}