@@ -80,7 +80,7 @@ public function getStacks(bool $currentPageOnly = false): iterable
80
80
$ page = $ this ;
81
81
while (true ) {
82
82
$ page ->initialize ();
83
- if ($ page ->nextToken ) {
83
+ if (null !== $ page ->nextToken ) {
84
84
$ input ->setNextToken ($ page ->nextToken );
85
85
86
86
$ this ->registerPrefetch ($ nextPage = $ client ->describeStacks ($ input ));
@@ -104,8 +104,8 @@ protected function populateResult(Response $response): void
104
104
$ data = new \SimpleXMLElement ($ response ->getContent ());
105
105
$ data = $ data ->DescribeStacksResult ;
106
106
107
- $ this ->stacks = ! $ data ->Stacks ? [] : $ this ->populateResultStacks ($ data -> Stacks );
108
- $ this ->nextToken = ($ v = $ data ->NextToken ) ? (string ) $ v : null ;
107
+ $ this ->stacks = ( 0 === ( $ v = $ data ->Stacks )-> count ()) ? [] : $ this ->populateResultStacks ($ v );
108
+ $ this ->nextToken = (null !== $ v = $ data ->NextToken [ 0 ] ) ? (string ) $ v : null ;
109
109
}
110
110
111
111
/**
@@ -115,10 +115,7 @@ private function populateResultCapabilities(\SimpleXMLElement $xml): array
115
115
{
116
116
$ items = [];
117
117
foreach ($ xml ->member as $ item ) {
118
- $ a = ($ v = $ item ) ? (string ) $ v : null ;
119
- if (null !== $ a ) {
120
- $ items [] = $ a ;
121
- }
118
+ $ items [] = (string ) $ item ;
122
119
}
123
120
124
121
return $ items ;
@@ -131,123 +128,155 @@ private function populateResultNotificationARNs(\SimpleXMLElement $xml): array
131
128
{
132
129
$ items = [];
133
130
foreach ($ xml ->member as $ item ) {
134
- $ a = ($ v = $ item ) ? (string ) $ v : null ;
135
- if (null !== $ a ) {
136
- $ items [] = $ a ;
137
- }
131
+ $ items [] = (string ) $ item ;
138
132
}
139
133
140
134
return $ items ;
141
135
}
142
136
137
+ private function populateResultOutput (\SimpleXMLElement $ xml ): Output
138
+ {
139
+ return new Output ([
140
+ 'OutputKey ' => (null !== $ v = $ xml ->OutputKey [0 ]) ? (string ) $ v : null ,
141
+ 'OutputValue ' => (null !== $ v = $ xml ->OutputValue [0 ]) ? (string ) $ v : null ,
142
+ 'Description ' => (null !== $ v = $ xml ->Description [0 ]) ? (string ) $ v : null ,
143
+ 'ExportName ' => (null !== $ v = $ xml ->ExportName [0 ]) ? (string ) $ v : null ,
144
+ ]);
145
+ }
146
+
143
147
/**
144
148
* @return Output[]
145
149
*/
146
150
private function populateResultOutputs (\SimpleXMLElement $ xml ): array
147
151
{
148
152
$ items = [];
149
153
foreach ($ xml ->member as $ item ) {
150
- $ items [] = new Output ([
151
- 'OutputKey ' => ($ v = $ item ->OutputKey ) ? (string ) $ v : null ,
152
- 'OutputValue ' => ($ v = $ item ->OutputValue ) ? (string ) $ v : null ,
153
- 'Description ' => ($ v = $ item ->Description ) ? (string ) $ v : null ,
154
- 'ExportName ' => ($ v = $ item ->ExportName ) ? (string ) $ v : null ,
155
- ]);
154
+ $ items [] = $ this ->populateResultOutput ($ item );
156
155
}
157
156
158
157
return $ items ;
159
158
}
160
159
160
+ private function populateResultParameter (\SimpleXMLElement $ xml ): Parameter
161
+ {
162
+ return new Parameter ([
163
+ 'ParameterKey ' => (null !== $ v = $ xml ->ParameterKey [0 ]) ? (string ) $ v : null ,
164
+ 'ParameterValue ' => (null !== $ v = $ xml ->ParameterValue [0 ]) ? (string ) $ v : null ,
165
+ 'UsePreviousValue ' => (null !== $ v = $ xml ->UsePreviousValue [0 ]) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
166
+ 'ResolvedValue ' => (null !== $ v = $ xml ->ResolvedValue [0 ]) ? (string ) $ v : null ,
167
+ ]);
168
+ }
169
+
161
170
/**
162
171
* @return Parameter[]
163
172
*/
164
173
private function populateResultParameters (\SimpleXMLElement $ xml ): array
165
174
{
166
175
$ items = [];
167
176
foreach ($ xml ->member as $ item ) {
168
- $ items [] = new Parameter ([
169
- 'ParameterKey ' => ($ v = $ item ->ParameterKey ) ? (string ) $ v : null ,
170
- 'ParameterValue ' => ($ v = $ item ->ParameterValue ) ? (string ) $ v : null ,
171
- 'UsePreviousValue ' => ($ v = $ item ->UsePreviousValue ) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
172
- 'ResolvedValue ' => ($ v = $ item ->ResolvedValue ) ? (string ) $ v : null ,
173
- ]);
177
+ $ items [] = $ this ->populateResultParameter ($ item );
174
178
}
175
179
176
180
return $ items ;
177
181
}
178
182
183
+ private function populateResultRollbackConfiguration (\SimpleXMLElement $ xml ): RollbackConfiguration
184
+ {
185
+ return new RollbackConfiguration ([
186
+ 'RollbackTriggers ' => (0 === ($ v = $ xml ->RollbackTriggers )->count ()) ? null : $ this ->populateResultRollbackTriggers ($ v ),
187
+ 'MonitoringTimeInMinutes ' => (null !== $ v = $ xml ->MonitoringTimeInMinutes [0 ]) ? (int ) (string ) $ v : null ,
188
+ ]);
189
+ }
190
+
191
+ private function populateResultRollbackTrigger (\SimpleXMLElement $ xml ): RollbackTrigger
192
+ {
193
+ return new RollbackTrigger ([
194
+ 'Arn ' => (string ) $ xml ->Arn ,
195
+ 'Type ' => (string ) $ xml ->Type ,
196
+ ]);
197
+ }
198
+
179
199
/**
180
200
* @return RollbackTrigger[]
181
201
*/
182
202
private function populateResultRollbackTriggers (\SimpleXMLElement $ xml ): array
183
203
{
184
204
$ items = [];
185
205
foreach ($ xml ->member as $ item ) {
186
- $ items [] = new RollbackTrigger ([
187
- 'Arn ' => (string ) $ item ->Arn ,
188
- 'Type ' => (string ) $ item ->Type ,
189
- ]);
206
+ $ items [] = $ this ->populateResultRollbackTrigger ($ item );
190
207
}
191
208
192
209
return $ items ;
193
210
}
194
211
212
+ private function populateResultStack (\SimpleXMLElement $ xml ): Stack
213
+ {
214
+ return new Stack ([
215
+ 'StackId ' => (null !== $ v = $ xml ->StackId [0 ]) ? (string ) $ v : null ,
216
+ 'StackName ' => (string ) $ xml ->StackName ,
217
+ 'ChangeSetId ' => (null !== $ v = $ xml ->ChangeSetId [0 ]) ? (string ) $ v : null ,
218
+ 'Description ' => (null !== $ v = $ xml ->Description [0 ]) ? (string ) $ v : null ,
219
+ 'Parameters ' => (0 === ($ v = $ xml ->Parameters )->count ()) ? null : $ this ->populateResultParameters ($ v ),
220
+ 'CreationTime ' => new \DateTimeImmutable ((string ) $ xml ->CreationTime ),
221
+ 'DeletionTime ' => (null !== $ v = $ xml ->DeletionTime [0 ]) ? new \DateTimeImmutable ((string ) $ v ) : null ,
222
+ 'LastUpdatedTime ' => (null !== $ v = $ xml ->LastUpdatedTime [0 ]) ? new \DateTimeImmutable ((string ) $ v ) : null ,
223
+ 'RollbackConfiguration ' => 0 === $ xml ->RollbackConfiguration ->count () ? null : $ this ->populateResultRollbackConfiguration ($ xml ->RollbackConfiguration ),
224
+ 'StackStatus ' => (string ) $ xml ->StackStatus ,
225
+ 'StackStatusReason ' => (null !== $ v = $ xml ->StackStatusReason [0 ]) ? (string ) $ v : null ,
226
+ 'DisableRollback ' => (null !== $ v = $ xml ->DisableRollback [0 ]) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
227
+ 'NotificationARNs ' => (0 === ($ v = $ xml ->NotificationARNs )->count ()) ? null : $ this ->populateResultNotificationARNs ($ v ),
228
+ 'TimeoutInMinutes ' => (null !== $ v = $ xml ->TimeoutInMinutes [0 ]) ? (int ) (string ) $ v : null ,
229
+ 'Capabilities ' => (0 === ($ v = $ xml ->Capabilities )->count ()) ? null : $ this ->populateResultCapabilities ($ v ),
230
+ 'Outputs ' => (0 === ($ v = $ xml ->Outputs )->count ()) ? null : $ this ->populateResultOutputs ($ v ),
231
+ 'RoleARN ' => (null !== $ v = $ xml ->RoleARN [0 ]) ? (string ) $ v : null ,
232
+ 'Tags ' => (0 === ($ v = $ xml ->Tags )->count ()) ? null : $ this ->populateResultTags ($ v ),
233
+ 'EnableTerminationProtection ' => (null !== $ v = $ xml ->EnableTerminationProtection [0 ]) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
234
+ 'ParentId ' => (null !== $ v = $ xml ->ParentId [0 ]) ? (string ) $ v : null ,
235
+ 'RootId ' => (null !== $ v = $ xml ->RootId [0 ]) ? (string ) $ v : null ,
236
+ 'DriftInformation ' => 0 === $ xml ->DriftInformation ->count () ? null : $ this ->populateResultStackDriftInformation ($ xml ->DriftInformation ),
237
+ 'RetainExceptOnCreate ' => (null !== $ v = $ xml ->RetainExceptOnCreate [0 ]) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
238
+ 'DeletionMode ' => (null !== $ v = $ xml ->DeletionMode [0 ]) ? (string ) $ v : null ,
239
+ 'DetailedStatus ' => (null !== $ v = $ xml ->DetailedStatus [0 ]) ? (string ) $ v : null ,
240
+ ]);
241
+ }
242
+
243
+ private function populateResultStackDriftInformation (\SimpleXMLElement $ xml ): StackDriftInformation
244
+ {
245
+ return new StackDriftInformation ([
246
+ 'StackDriftStatus ' => (string ) $ xml ->StackDriftStatus ,
247
+ 'LastCheckTimestamp ' => (null !== $ v = $ xml ->LastCheckTimestamp [0 ]) ? new \DateTimeImmutable ((string ) $ v ) : null ,
248
+ ]);
249
+ }
250
+
195
251
/**
196
252
* @return Stack[]
197
253
*/
198
254
private function populateResultStacks (\SimpleXMLElement $ xml ): array
199
255
{
200
256
$ items = [];
201
257
foreach ($ xml ->member as $ item ) {
202
- $ items [] = new Stack ([
203
- 'StackId ' => ($ v = $ item ->StackId ) ? (string ) $ v : null ,
204
- 'StackName ' => (string ) $ item ->StackName ,
205
- 'ChangeSetId ' => ($ v = $ item ->ChangeSetId ) ? (string ) $ v : null ,
206
- 'Description ' => ($ v = $ item ->Description ) ? (string ) $ v : null ,
207
- 'Parameters ' => !$ item ->Parameters ? null : $ this ->populateResultParameters ($ item ->Parameters ),
208
- 'CreationTime ' => new \DateTimeImmutable ((string ) $ item ->CreationTime ),
209
- 'DeletionTime ' => ($ v = $ item ->DeletionTime ) ? new \DateTimeImmutable ((string ) $ v ) : null ,
210
- 'LastUpdatedTime ' => ($ v = $ item ->LastUpdatedTime ) ? new \DateTimeImmutable ((string ) $ v ) : null ,
211
- 'RollbackConfiguration ' => !$ item ->RollbackConfiguration ? null : new RollbackConfiguration ([
212
- 'RollbackTriggers ' => !$ item ->RollbackConfiguration ->RollbackTriggers ? null : $ this ->populateResultRollbackTriggers ($ item ->RollbackConfiguration ->RollbackTriggers ),
213
- 'MonitoringTimeInMinutes ' => ($ v = $ item ->RollbackConfiguration ->MonitoringTimeInMinutes ) ? (int ) (string ) $ v : null ,
214
- ]),
215
- 'StackStatus ' => (string ) $ item ->StackStatus ,
216
- 'StackStatusReason ' => ($ v = $ item ->StackStatusReason ) ? (string ) $ v : null ,
217
- 'DisableRollback ' => ($ v = $ item ->DisableRollback ) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
218
- 'NotificationARNs ' => !$ item ->NotificationARNs ? null : $ this ->populateResultNotificationARNs ($ item ->NotificationARNs ),
219
- 'TimeoutInMinutes ' => ($ v = $ item ->TimeoutInMinutes ) ? (int ) (string ) $ v : null ,
220
- 'Capabilities ' => !$ item ->Capabilities ? null : $ this ->populateResultCapabilities ($ item ->Capabilities ),
221
- 'Outputs ' => !$ item ->Outputs ? null : $ this ->populateResultOutputs ($ item ->Outputs ),
222
- 'RoleARN ' => ($ v = $ item ->RoleARN ) ? (string ) $ v : null ,
223
- 'Tags ' => !$ item ->Tags ? null : $ this ->populateResultTags ($ item ->Tags ),
224
- 'EnableTerminationProtection ' => ($ v = $ item ->EnableTerminationProtection ) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
225
- 'ParentId ' => ($ v = $ item ->ParentId ) ? (string ) $ v : null ,
226
- 'RootId ' => ($ v = $ item ->RootId ) ? (string ) $ v : null ,
227
- 'DriftInformation ' => !$ item ->DriftInformation ? null : new StackDriftInformation ([
228
- 'StackDriftStatus ' => (string ) $ item ->DriftInformation ->StackDriftStatus ,
229
- 'LastCheckTimestamp ' => ($ v = $ item ->DriftInformation ->LastCheckTimestamp ) ? new \DateTimeImmutable ((string ) $ v ) : null ,
230
- ]),
231
- 'RetainExceptOnCreate ' => ($ v = $ item ->RetainExceptOnCreate ) ? filter_var ((string ) $ v , \FILTER_VALIDATE_BOOLEAN ) : null ,
232
- 'DeletionMode ' => ($ v = $ item ->DeletionMode ) ? (string ) $ v : null ,
233
- 'DetailedStatus ' => ($ v = $ item ->DetailedStatus ) ? (string ) $ v : null ,
234
- ]);
258
+ $ items [] = $ this ->populateResultStack ($ item );
235
259
}
236
260
237
261
return $ items ;
238
262
}
239
263
264
+ private function populateResultTag (\SimpleXMLElement $ xml ): Tag
265
+ {
266
+ return new Tag ([
267
+ 'Key ' => (string ) $ xml ->Key ,
268
+ 'Value ' => (string ) $ xml ->Value ,
269
+ ]);
270
+ }
271
+
240
272
/**
241
273
* @return Tag[]
242
274
*/
243
275
private function populateResultTags (\SimpleXMLElement $ xml ): array
244
276
{
245
277
$ items = [];
246
278
foreach ($ xml ->member as $ item ) {
247
- $ items [] = new Tag ([
248
- 'Key ' => (string ) $ item ->Key ,
249
- 'Value ' => (string ) $ item ->Value ,
250
- ]);
279
+ $ items [] = $ this ->populateResultTag ($ item );
251
280
}
252
281
253
282
return $ items ;
0 commit comments