Skip to content

Commit

Permalink
Refactored error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Millard committed Mar 3, 2016
1 parent d8c1d47 commit 8d43ffd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/pmill/Plesk/CreateSecretKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(array $config, array $params = [])
protected function processResponse($xml)
{
if ($xml->{'secret_key'}->create->result->status == 'error') {
throw new ApiRequestException($xml->{'secret_key'}->create->result->errtext);
throw new ApiRequestException($xml->{'secret_key'}->create->result);
}

$this->key = (string)$xml->{'secret_key'}->create->result->key;
Expand Down
19 changes: 13 additions & 6 deletions src/pmill/Plesk/DeleteSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

class DeleteSubscription extends BaseRequest
{
/**
* @var string
*/
public $xml_packet = <<<EOT
<?xml version="1.0"?>
<packet>
Expand All @@ -16,22 +19,26 @@ class DeleteSubscription extends BaseRequest
</packet>
EOT;

protected $default_params = array(
'id'=>NULL,
);
/**
* @var array
*/
protected $default_params = array(
'id' => null,
);

/**
* Process the response from Plesk
* @param $xml
* @return bool
* @throws ApiRequestException
*/
protected function processResponse($xml)
{
$webspace = $xml->webspace->del;
$webspace = $xml->webspace->del;

if ($webspace->result->status == 'error') {
throw new ApiRequestException($webspace->result);
}

return TRUE;
return true;
}
}

0 comments on commit 8d43ffd

Please sign in to comment.