Skip to content

Commit dc44f6e

Browse files
LKaemmerlingStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 678ef8f commit dc44f6e

File tree

6 files changed

+52
-67
lines changed

6 files changed

+52
-67
lines changed

src/Models/Servers/Server.php

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ protected function parsePrivateNet(array $privateNets)
171171
foreach ($privateNets as $privateNet) {
172172
$parsed[] = new ServerPrivateNet($privateNet->network, $privateNet->ip, $privateNet->alias_ips, $privateNet->mac_address);
173173
}
174-
return $parsed;
175174

175+
return $parsed;
176176
}
177177

178178
/**
@@ -207,9 +207,9 @@ public function reload()
207207
public function powerOn(): ?APIResponse
208208
{
209209
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/poweron'));
210-
if (!HetznerAPIClient::hasError($response)) {
210+
if (! HetznerAPIClient::hasError($response)) {
211211
return APIResponse::create([
212-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
212+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
213213
], $response->getHeaders());
214214
}
215215

@@ -226,9 +226,9 @@ public function powerOn(): ?APIResponse
226226
public function softReboot(): ?APIResponse
227227
{
228228
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/reboot'));
229-
if (!HetznerAPIClient::hasError($response)) {
229+
if (! HetznerAPIClient::hasError($response)) {
230230
return APIResponse::create([
231-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
231+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
232232
], $response->getHeaders());
233233
}
234234

@@ -245,9 +245,9 @@ public function softReboot(): ?APIResponse
245245
public function reset(): ?APIResponse
246246
{
247247
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/reset'));
248-
if (!HetznerAPIClient::hasError($response)) {
248+
if (! HetznerAPIClient::hasError($response)) {
249249
return APIResponse::create([
250-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
250+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
251251
], $response->getHeaders());
252252
}
253253

@@ -264,9 +264,9 @@ public function reset(): ?APIResponse
264264
public function shutdown(): ?APIResponse
265265
{
266266
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/shutdown'));
267-
if (!HetznerAPIClient::hasError($response)) {
267+
if (! HetznerAPIClient::hasError($response)) {
268268
return APIResponse::create([
269-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
269+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
270270
], $response->getHeaders());
271271
}
272272

@@ -283,9 +283,9 @@ public function shutdown(): ?APIResponse
283283
public function powerOff(): ?APIResponse
284284
{
285285
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/poweroff'));
286-
if (!HetznerAPIClient::hasError($response)) {
286+
if (! HetznerAPIClient::hasError($response)) {
287287
return APIResponse::create([
288-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
288+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
289289
], $response->getHeaders());
290290
}
291291

@@ -302,8 +302,8 @@ public function powerOff(): ?APIResponse
302302
public function resetRootPassword(): ?APIResponse
303303
{
304304
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/reset_password'));
305-
if (!HetznerAPIClient::hasError($response)) {
306-
$payload = json_decode((string)$response->getBody());
305+
if (! HetznerAPIClient::hasError($response)) {
306+
$payload = json_decode((string) $response->getBody());
307307

308308
return APIResponse::create([
309309
'action' => Action::parse($payload->action),
@@ -331,8 +331,8 @@ public function enableRescue($type = 'linux64', $ssh_keys = []): ?APIResponse
331331
'ssh_keys' => $ssh_keys,
332332
],
333333
]);
334-
if (!HetznerAPIClient::hasError($response)) {
335-
$payload = json_decode((string)$response->getBody());
334+
if (! HetznerAPIClient::hasError($response)) {
335+
$payload = json_decode((string) $response->getBody());
336336

337337
return APIResponse::create([
338338
'action' => Action::parse($payload->action),
@@ -353,9 +353,9 @@ public function enableRescue($type = 'linux64', $ssh_keys = []): ?APIResponse
353353
public function disableRescue(): ?APIResponse
354354
{
355355
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/disable_rescue'));
356-
if (!HetznerAPIClient::hasError($response)) {
356+
if (! HetznerAPIClient::hasError($response)) {
357357
return APIResponse::create([
358-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
358+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
359359
], $response->getHeaders());
360360
}
361361

@@ -378,14 +378,14 @@ public function createImage(string $description = '', string $type = 'snapshot',
378378
'description' => $description,
379379
'type' => $type,
380380
];
381-
if (!empty($labels)) {
381+
if (! empty($labels)) {
382382
$payload['labels'] = $labels;
383383
}
384384
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/create_image'), [
385385
'json' => $payload,
386386
]);
387-
if (!HetznerAPIClient::hasError($response)) {
388-
$payload = json_decode((string)$response->getBody());
387+
if (! HetznerAPIClient::hasError($response)) {
388+
$payload = json_decode((string) $response->getBody());
389389

390390
return APIResponse::create([
391391
'action' => Action::parse($payload->action),
@@ -411,8 +411,8 @@ public function rebuildFromImage(Image $image): ?APIResponse
411411
'image' => $image->id ?: $image->name,
412412
],
413413
]);
414-
if (!HetznerAPIClient::hasError($response)) {
415-
$payload = json_decode((string)$response->getBody());
414+
if (! HetznerAPIClient::hasError($response)) {
415+
$payload = json_decode((string) $response->getBody());
416416

417417
return APIResponse::create(array_merge([
418418
'action' => Action::parse($payload->action),
@@ -439,9 +439,9 @@ public function changeType(ServerType $serverType, bool $upgradeDisk = false): ?
439439
'upgrade_disk' => $upgradeDisk,
440440
],
441441
]);
442-
if (!HetznerAPIClient::hasError($response)) {
442+
if (! HetznerAPIClient::hasError($response)) {
443443
return APIResponse::create([
444-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
444+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
445445
], $response->getHeaders());
446446
}
447447

@@ -458,9 +458,9 @@ public function changeType(ServerType $serverType, bool $upgradeDisk = false): ?
458458
public function enableBackups(string $backupWindow = null): ?APIResponse
459459
{
460460
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/enable_backup'));
461-
if (!HetznerAPIClient::hasError($response)) {
461+
if (! HetznerAPIClient::hasError($response)) {
462462
return APIResponse::create([
463-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
463+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
464464
], $response->getHeaders());
465465
}
466466

@@ -477,9 +477,9 @@ public function enableBackups(string $backupWindow = null): ?APIResponse
477477
public function disableBackups(): ?APIResponse
478478
{
479479
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/disable_backup'));
480-
if (!HetznerAPIClient::hasError($response)) {
480+
if (! HetznerAPIClient::hasError($response)) {
481481
return APIResponse::create([
482-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
482+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
483483
], $response->getHeaders());
484484
}
485485

@@ -501,9 +501,9 @@ public function attachISO(ISO $iso): ?APIResponse
501501
'iso' => $iso->name ?: $iso->id,
502502
],
503503
]);
504-
if (!HetznerAPIClient::hasError($response)) {
504+
if (! HetznerAPIClient::hasError($response)) {
505505
return APIResponse::create([
506-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
506+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
507507
], $response->getHeaders());
508508
}
509509

@@ -520,9 +520,9 @@ public function attachISO(ISO $iso): ?APIResponse
520520
public function detachISO(): ?APIResponse
521521
{
522522
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/detach_iso'));
523-
if (!HetznerAPIClient::hasError($response)) {
523+
if (! HetznerAPIClient::hasError($response)) {
524524
return APIResponse::create([
525-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
525+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
526526
], $response->getHeaders());
527527
}
528528

@@ -546,9 +546,9 @@ public function changeReverseDNS(string $ip, string $dnsPtr): ?APIResponse
546546
'dns_ptr' => $dnsPtr,
547547
],
548548
]);
549-
if (!HetznerAPIClient::hasError($response)) {
549+
if (! HetznerAPIClient::hasError($response)) {
550550
return APIResponse::create([
551-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
551+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
552552
], $response->getHeaders());
553553
}
554554

@@ -568,10 +568,10 @@ public function changeReverseDNS(string $ip, string $dnsPtr): ?APIResponse
568568
*/
569569
public function metrics(string $type, string $start, string $end, int $step = null)
570570
{
571-
$response = $this->httpClient->get($this->replaceServerIdInUri('servers/{id}/metrics?') . http_build_query(compact('type', 'start', 'end', 'step')));
572-
if (!HetznerAPIClient::hasError($response)) {
571+
$response = $this->httpClient->get($this->replaceServerIdInUri('servers/{id}/metrics?').http_build_query(compact('type', 'start', 'end', 'step')));
572+
if (! HetznerAPIClient::hasError($response)) {
573573
return APIResponse::create([
574-
'metrics' => json_decode((string)$response->getBody())->metrics,
574+
'metrics' => json_decode((string) $response->getBody())->metrics,
575575
], $response->getHeaders());
576576
}
577577

@@ -588,9 +588,9 @@ public function metrics(string $type, string $start, string $end, int $step = nu
588588
public function delete(): ?APIResponse
589589
{
590590
$response = $this->httpClient->delete($this->replaceServerIdInUri('servers/{id}'));
591-
if (!HetznerAPIClient::hasError($response)) {
591+
if (! HetznerAPIClient::hasError($response)) {
592592
return APIResponse::create([
593-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
593+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
594594
], $response->getHeaders());
595595
}
596596

@@ -610,9 +610,9 @@ public function update(array $data)
610610
$response = $this->httpClient->put($this->replaceServerIdInUri('servers/{id}'), [
611611
'json' => $data,
612612
]);
613-
if (!HetznerAPIClient::hasError($response)) {
613+
if (! HetznerAPIClient::hasError($response)) {
614614
return APIResponse::create([
615-
'server' => self::parse(json_decode((string)$response->getBody())->server),
615+
'server' => self::parse(json_decode((string) $response->getBody())->server),
616616
], $response->getHeaders());
617617
}
618618

@@ -629,8 +629,8 @@ public function update(array $data)
629629
public function requestConsole(): ?APIResponse
630630
{
631631
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/request_console'));
632-
if (!HetznerAPIClient::hasError($response)) {
633-
$payload = json_decode((string)$response->getBody());
632+
if (! HetznerAPIClient::hasError($response)) {
633+
$payload = json_decode((string) $response->getBody());
634634

635635
return APIResponse::create([
636636
'action' => Action::parse($payload->action),
@@ -659,9 +659,9 @@ public function changeProtection(bool $delete = true, bool $rebuild = true): ?AP
659659
'rebuild' => $rebuild,
660660
],
661661
]);
662-
if (!HetznerAPIClient::hasError($response)) {
662+
if (! HetznerAPIClient::hasError($response)) {
663663
return APIResponse::create([
664-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
664+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
665665
], $response->getHeaders());
666666
}
667667

@@ -689,9 +689,9 @@ public function attachToNetwork(Network $network, string $ip = null, array $alia
689689
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/attach_to_network'), [
690690
'json' => $payload,
691691
]);
692-
if (!HetznerAPIClient::hasError($response)) {
692+
if (! HetznerAPIClient::hasError($response)) {
693693
return APIResponse::create([
694-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
694+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
695695
], $response->getHeaders());
696696
}
697697

@@ -712,9 +712,9 @@ public function detachFromNetwork(Network $network)
712712
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/detach_from_network'), [
713713
'json' => $payload,
714714
]);
715-
if (!HetznerAPIClient::hasError($response)) {
715+
if (! HetznerAPIClient::hasError($response)) {
716716
return APIResponse::create([
717-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
717+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
718718
], $response->getHeaders());
719719
}
720720

@@ -736,9 +736,9 @@ public function changeAliasIPs(Network $network, array $aliasIps)
736736
$response = $this->httpClient->post($this->replaceServerIdInUri('servers/{id}/actions/change_alias_ips'), [
737737
'json' => $payload,
738738
]);
739-
if (!HetznerAPIClient::hasError($response)) {
739+
if (! HetznerAPIClient::hasError($response)) {
740740
return APIResponse::create([
741-
'action' => Action::parse(json_decode((string)$response->getBody())->action),
741+
'action' => Action::parse(json_decode((string) $response->getBody())->action),
742742
], $response->getHeaders());
743743
}
744744

src/Models/Servers/ServerPrivateNet.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?php
22

3-
43
namespace LKDev\HetznerCloud\Models\Servers;
54

6-
7-
85
class ServerPrivateNet
96
{
107
/**

src/Models/Servers/ServerPublicNet.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace LKDev\HetznerCloud\Models\Servers;
54

6-
75
class ServerPublicNet
86
{
97
/**

src/Models/Servers/ServerPublicNetIPv4.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace LKDev\HetznerCloud\Models\Servers;
54

6-
75
class ServerPublicNetIPv4
86
{
97
/**
@@ -30,5 +28,4 @@ public static function parse(\stdClass $data)
3028
{
3129
return new self($data->ip, $data->blocked, $data->dns_ptr);
3230
}
33-
3431
}

src/Models/Servers/ServerPublicNetIPv6.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace LKDev\HetznerCloud\Models\Servers;
54

6-
75
class ServerPublicNetIPv6
86
{
97
/**
@@ -38,7 +36,7 @@ public static function parse(\stdClass $data)
3836
foreach ($data->dns_ptr as $dnsPtr) {
3937
$dnsPtrs[] = new ServerPublicNetIPv6DnsPtr($dnsPtr->ip, $dnsPtr->dns_ptr);
4038
}
39+
4140
return new self($data->ip, $data->blocked, $dnsPtrs);
4241
}
43-
4442
}

src/Models/Servers/ServerPublicNetIPv6DnsPtr.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace LKDev\HetznerCloud\Models\Servers;
54

6-
75
class ServerPublicNetIPv6DnsPtr
86
{
97
/**
@@ -21,7 +19,4 @@ public function __construct(string $ip, array $dnsPtr)
2119
$this->ip = $ip;
2220
$this->dnsPtr = $dnsPtr;
2321
}
24-
25-
26-
2722
}

0 commit comments

Comments
 (0)