-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathAXValue.php
More file actions
91 lines (82 loc) · 1.78 KB
/
AXValue.php
File metadata and controls
91 lines (82 loc) · 1.78 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
<?php
namespace ChromeDevtoolsProtocol\Model\Accessibility;
/**
* A single computed AX property.
*
* @generated This file has been auto-generated, do not edit.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
final class AXValue implements \JsonSerializable
{
/**
* The type of this value.
*
* @var string
*/
public $type;
/**
* The computed value of this property.
*
* @var mixed|null
*/
public $value;
/**
* One or more related nodes, if applicable.
*
* @var AXRelatedNode[]|null
*/
public $relatedNodes;
/**
* The sources which contributed to the computation of this property.
*
* @var AXValueSource[]|null
*/
public $sources;
public static function fromJson($data)
{
$instance = new static();
if (isset($data->type)) {
$instance->type = (string)$data->type;
}
if (isset($data->value)) {
$instance->value = $data->value;
}
if (isset($data->relatedNodes)) {
$instance->relatedNodes = [];
foreach ($data->relatedNodes as $item) {
$instance->relatedNodes[] = AXRelatedNode::fromJson($item);
}
}
if (isset($data->sources)) {
$instance->sources = [];
foreach ($data->sources as $item) {
$instance->sources[] = AXValueSource::fromJson($item);
}
}
return $instance;
}
public function jsonSerialize(): mixed
{
$data = new \stdClass();
if ($this->type !== null) {
$data->type = $this->type;
}
if ($this->value !== null) {
$data->value = $this->value;
}
if ($this->relatedNodes !== null) {
$data->relatedNodes = [];
foreach ($this->relatedNodes as $item) {
$data->relatedNodes[] = $item->jsonSerialize();
}
}
if ($this->sources !== null) {
$data->sources = [];
foreach ($this->sources as $item) {
$data->sources[] = $item->jsonSerialize();
}
}
return $data;
}
}