Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue3 the constructor should throw the exception #7

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Vat/Provider/Europa.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ class Europa implements Providable
/** @var SoapClient */
private $oClient;

/**
* Europa Provider constructor
*
* @throws Exception
*/
public function __construct()
{
try {
$this->oClient = new SoapClient($this->getApiUrl());
} catch (SoapFault $oExcept) {
exit('Impossible to connect to the europa SOAP : ' . $oExcept->faultstring);
throw new Exception('Impossible to connect to the Europa SOAP : ' .$oExcept->faultstring, 0, $oExcept);
}
}

Expand All @@ -43,7 +48,6 @@ public function getApiUrl(): string
*
* @return stdClass The VAT number's details.
*
* @throws SoapFault
* @throws Exception
*/
public function getResource($sVatNumber, string $sCountryCode): stdClass
Expand Down