Skip to content

Commit

Permalink
Fix: not always an array
Browse files Browse the repository at this point in the history
  • Loading branch information
tvlooy committed Apr 7, 2021
1 parent 73d54d6 commit 403d881
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Command/Accounts/CreateAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function prepare(): void
public function processResponse(array $response)
{
if (isset($response['headers']['Location'])) {
$link = $response['headers']['Location'][0];
$link = ((array) $response['headers']['Location'])[0];
} else {
$link = $response['headers']['location'][0];
$link = ((array) $response['headers']['location'])[0];
}
$id = substr($link, strrpos($link, '/') + 1);

Expand Down
4 changes: 2 additions & 2 deletions src/Command/Dns/CreateRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function prepare(): void
public function processResponse(array $response)
{
if (isset($response['headers']['Location'])) {
return explode('/', current($response['headers']['Location']))[5];
return explode('/', current((array) $response['headers']['Location']))[5];
}

return explode('/', current($response['headers']['location']))[5];
return explode('/', current((array) $response['headers']['location']))[5];
}
}
4 changes: 2 additions & 2 deletions src/Command/Domains/RegisterDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function prepare(): void
public function processResponse(array $response)
{
if (isset($response['headers']['Location'])) {
return explode('/', $response['headers']['Location'][0])[3];
return explode('/', ((array) $response['headers']['Location'])[0])[3];
}

return explode('/', $response['headers']['location'][0])[3];
return explode('/', ((array) $response['headers']['location'])[0])[3];
}
}
4 changes: 2 additions & 2 deletions src/Command/MysqlDatabases/CreateMysqlDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function prepare(): void
public function processResponse(array $response)
{
if (isset($response['headers']['Location'])) {
return explode('/', $response['headers']['Location'][0])[3];
return explode('/', ((array) $response['headers']['Location'])[0])[3];
}

return explode('/', $response['headers']['location'][0])[3];
return explode('/', ((array) $response['headers']['location'])[0])[3];
}
}

0 comments on commit 403d881

Please sign in to comment.