Skip to content

Commit

Permalink
fix styles and bug
Browse files Browse the repository at this point in the history
  • Loading branch information
otis22 committed Mar 13, 2023
1 parent 15ee553 commit 8eb0a62
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Url/FromJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public function asString(): string
public static function fromDomainAndBillingApi(Domain $domain, BillingApi $billingApi): self
{
$billingUrl = $billingApi->asString() . "/host/" . $domain->asString();
new self(
file_get_contents($billingUrl)
);
$jsonText = file_get_contents($billingUrl);
if ($jsonText === false) {
throw new \Exception('Can`t create FromJson object. Invalid server response.');
}
return new self($jsonText);
}

private function validateResponse(\stdClass $json): void
Expand All @@ -65,4 +67,4 @@ private function hostName(\stdClass $json): string
{
return $json->url;
}
}
}

0 comments on commit 8eb0a62

Please sign in to comment.