forked from coucounco/salto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
308 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Exceptions; | ||
|
||
use Exception; | ||
|
||
class ConnectionFailedException extends Exception | ||
{ | ||
public function __construct($endpoint, $port) | ||
{ | ||
parent::__construct("Failed to connect to '.$endpoint.':'.$port.'", 5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Exceptions; | ||
|
||
use rohsyl\Salto\Response\Response; | ||
|
||
class NakException extends SaltoException | ||
{ | ||
public function __construct(Response $response) | ||
{ | ||
parent::__construct($response, 'Nak. Server refused the command', 11); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Exceptions; | ||
|
||
use rohsyl\Salto\Response\Response; | ||
|
||
class SaltoErrorException extends SaltoException | ||
{ | ||
public function __construct(Response $response) | ||
{ | ||
parent::__construct( | ||
$response, | ||
'Error : ' . $response->getCommandName() . ' : ' . $response->getErrorDescription(), | ||
12 | ||
); | ||
} | ||
|
||
public function getErrorName() : string { | ||
return $this->getResponse()->getCommandName(); | ||
} | ||
|
||
public function getErrorDescription() : ?string { | ||
return $this->getResponse()->getErrorDescription(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Exceptions; | ||
|
||
use rohsyl\Salto\Messages\Message; | ||
use rohsyl\Salto\Response\Response; | ||
|
||
class SaltoException extends \Exception | ||
{ | ||
private Response $response; | ||
|
||
public function __construct(Response $response, string $message = "", int $code = 0, ?Throwable $previous = null) | ||
{ | ||
parent::__construct($message, $code, $previous); | ||
$this->response = $response; | ||
} | ||
|
||
public function getResponse(): Response | ||
{ | ||
return $this->response; | ||
} | ||
|
||
public function getRequest() : ?Message | ||
{ | ||
return $this->getResponse()->getRequest(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Exceptions; | ||
|
||
use rohsyl\Salto\Response\Response; | ||
|
||
class WrongChecksumException extends SaltoException | ||
{ | ||
public function __construct(Response $response) | ||
{ | ||
parent::__construct($response, "Wrong checksum exception", 10); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/Message/CheckoutMessage.php → src/Messages/CheckoutMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Message; | ||
namespace rohsyl\Salto\Messages; | ||
|
||
class CheckoutMessage extends Message | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
src/Message/CopyMobileMessage.php → src/Messages/CopyMobileMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Message/EncodeMobileMessage.php → src/Messages/EncodeMobileMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace rohsyl\Salto\Message; | ||
namespace rohsyl\Salto\Messages; | ||
|
||
use rohsyl\Salto\SaltoClient; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.