1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Response; |
4
|
|
|
|
5
|
|
|
use ArrayObject; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @template-extends \ArrayObject<int, object> |
9
|
|
|
*/ |
10
|
|
|
class BulkCodeSwitchResponse extends ArrayObject |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param array<object>|object $bulkCodeSwitch |
14
|
|
|
*/ |
15
|
|
|
public function __construct(array|object $bulkCodeSwitch) |
16
|
|
|
{ |
17
|
|
|
if (is_array($bulkCodeSwitch)) { |
|
|
|
|
18
|
|
|
// Handle array of bulk code switches |
19
|
|
|
parent::__construct( |
20
|
|
|
array_map( |
21
|
|
|
static function ($item) { |
22
|
|
|
return (object) $item; |
23
|
|
|
}, |
24
|
|
|
$bulkCodeSwitch |
25
|
|
|
), |
26
|
|
|
self::ARRAY_AS_PROPS |
27
|
|
|
); |
28
|
|
|
} else { |
29
|
|
|
// Handle single bulk code switch object |
30
|
|
|
parent::__construct( |
31
|
|
|
[$bulkCodeSwitch], |
32
|
|
|
self::ARRAY_AS_PROPS |
33
|
|
|
); |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get the bulk code switch ID. |
39
|
|
|
*/ |
40
|
|
|
public function getId(): ?string |
41
|
|
|
{ |
42
|
|
|
$first = $this[0] ?? null; |
43
|
|
|
return $first?->id ?? null; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get the codebase ID. |
48
|
|
|
*/ |
49
|
|
|
public function getCodebaseId(): ?string |
50
|
|
|
{ |
51
|
|
|
$first = $this[0] ?? null; |
52
|
|
|
return $first?->codebase_id ?? null; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get the reference. |
57
|
|
|
*/ |
58
|
|
|
public function getReference(): ?string |
59
|
|
|
{ |
60
|
|
|
$first = $this[0] ?? null; |
61
|
|
|
return $first?->reference ?? null; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get the status. |
66
|
|
|
*/ |
67
|
|
|
public function getStatus(): ?string |
68
|
|
|
{ |
69
|
|
|
$first = $this[0] ?? null; |
70
|
|
|
return $first?->status ?? null; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Get the created timestamp. |
75
|
|
|
*/ |
76
|
|
|
public function getCreatedAt(): ?string |
77
|
|
|
{ |
78
|
|
|
$first = $this[0] ?? null; |
79
|
|
|
return $first?->created_at ?? null; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get the message. |
84
|
|
|
*/ |
85
|
|
|
public function getMessage(): ?string |
86
|
|
|
{ |
87
|
|
|
$first = $this[0] ?? null; |
88
|
|
|
return $first?->message ?? null; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|