2
2
3
3
namespace Textalk \WebshopClient ;
4
4
5
- use Tivoka \Client \Request ;
6
-
7
5
class Exception extends \Exception {
8
6
protected static $ class_by_code = array (
9
7
-32700 => 'ParseError ' ,
@@ -21,8 +19,8 @@ class Exception extends \Exception {
21
19
*
22
20
* @return Exception Generic or specific subclass
23
21
*/
24
- public static function factory (\Tivoka \ Client \ Connection \ WebSocket $ connection ,
25
- Request $ request ) {
22
+ public static function factory (\Textalk \ WebshopClient \ ConnectionInterface $ connection ,
23
+ \ Tivoka \ Client \ Request $ request ) {
26
24
if (array_key_exists ($ request ->error , self ::$ class_by_code )) {
27
25
$ exception_class
28
26
= 'Textalk \\WebshopClient \\Exception \\' . self ::$ class_by_code [$ request ->error ];
@@ -50,15 +48,16 @@ public function getRpcMessage() { return $this->request->errorMessage; }
50
48
// Protected
51
49
//
52
50
53
- protected $ request ; ///< Tivoka\Client\Request The request that failed
54
- protected $ connection ; ///< Tivoka\Client\Connection\WebSocket The connection that was used
51
+ protected $ connection ; ///< Textalk\WebshopClient\ConnectionInterface The connection that was used.
52
+ protected $ request ; ///< Tivoka\Client\Request The request that failed.
55
53
56
54
/**
57
55
* Construct a new Exception.
58
56
*
59
57
* This can't be protected since it extends Exception, but it shouldn't be used. Use factory.
60
58
*/
61
- public function __construct (\Tivoka \Client \Connection \WebSocket $ connection , Request $ request ) {
59
+ public function __construct (\Textalk \WebshopClient \ConnectionInterface $ connection ,
60
+ \Tivoka \Client \Request $ request ) {
62
61
$ this ->request = $ request ;
63
62
$ this ->connection = $ connection ;
64
63
0 commit comments