|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Response; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class SiteInstanceResponse |
|
7
|
|
|
* |
|
8
|
|
|
* @package AcquiaCloudApi\Response |
|
9
|
|
|
*/ |
|
10
|
|
|
class SiteInstanceResponse |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* The site ID string |
|
14
|
|
|
*/ |
|
15
|
|
|
public string $site_id; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* The environment ID string |
|
19
|
|
|
*/ |
|
20
|
|
|
public string $environment_id; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* The status of the site instance |
|
24
|
|
|
* |
|
25
|
|
|
* One of: "SITE_INSTANCE_STATUS_UNSPECIFIED", "SITE_INSTANCE_STATUS_PENDING", |
|
26
|
|
|
* "SITE_INSTANCE_STATUS_READY", "SITE_INSTANCE_STATUS_FAILED", |
|
27
|
|
|
* "SITE_INSTANCE_STATUS_MARKED_FOR_DELETION", "SITE_INSTANCE_STATUS_DELETING", |
|
28
|
|
|
* "SITE_INSTANCE_STATUS_DELETED", "SITE_INSTANCE_STATUS_DELETE_FAILED", |
|
29
|
|
|
* "SITE_INSTANCE_STATUS_SYNCING", "SITE_INSTANCE_STATUS_FINALIZING", |
|
30
|
|
|
* "SITE_INSTANCE_STATUS_DISABLED" |
|
31
|
|
|
*/ |
|
32
|
|
|
public string $status; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* The health status of the site instance |
|
36
|
|
|
* |
|
37
|
|
|
* Object with code, summary and details properties |
|
38
|
|
|
*/ |
|
39
|
|
|
public ?object $health_status; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* The domains associated with this site instance |
|
43
|
|
|
* |
|
44
|
|
|
* @var array<object> Array of domain objects with name and is_managed properties |
|
45
|
|
|
*/ |
|
46
|
|
|
public ?array $domains; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* The site object containing site information |
|
50
|
|
|
*/ |
|
51
|
|
|
public ?SiteResponse $site = null; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* The environment object containing environment information |
|
55
|
|
|
*/ |
|
56
|
|
|
public ?CodebaseEnvironmentResponse $environment = null; |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* The links object containing related URLs |
|
61
|
|
|
*/ |
|
62
|
|
|
public object $links; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* SiteInstanceResponse constructor. |
|
66
|
|
|
*/ |
|
67
|
|
|
public function __construct(object $siteInstance) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->site_id = $siteInstance->site_id; |
|
70
|
|
|
$this->environment_id = $siteInstance->environment_id; |
|
71
|
|
|
$this->status = $siteInstance->status; |
|
72
|
|
|
|
|
73
|
|
|
// Make sure health_status is always an object, whether it's null, missing, or an array |
|
74
|
|
|
$health_status = $siteInstance->health_status ?? []; |
|
75
|
|
|
$this->health_status = is_object($health_status) ? $health_status : (object) $health_status; |
|
76
|
|
|
|
|
77
|
|
|
$this->domains = $siteInstance->domains ?? []; |
|
78
|
|
|
// Make sure $links is always an object, whether it's null, missing, or an array |
|
79
|
|
|
$links = $siteInstance->_links ?? []; |
|
80
|
|
|
$this->links = is_object($links) ? $links : (object) $links; |
|
81
|
|
|
|
|
82
|
|
|
// Handle legacy properties for backward compatibility |
|
83
|
|
|
if (property_exists($siteInstance, 'site')) { |
|
84
|
|
|
$this->site = new SiteResponse($siteInstance->site); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
if (property_exists($siteInstance, 'environment')) { |
|
88
|
|
|
$this->environment = new CodebaseEnvironmentResponse($siteInstance->environment); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|