@@ 19-51 (lines=33) @@ | ||
16 | * Class NetworkSocketException. |
|
17 | * This exception can be thrown during network operations. |
|
18 | */ |
|
19 | class NetworkSocketException extends SocketException |
|
20 | { |
|
21 | /** |
|
22 | * Socket with this exception |
|
23 | * |
|
24 | * @var SocketInterface |
|
25 | */ |
|
26 | private $socket; |
|
27 | ||
28 | /** |
|
29 | * Construct the exception. |
|
30 | * |
|
31 | * @param SocketInterface $socket Socket object |
|
32 | * @param string $message The Exception message to throw. |
|
33 | * @param int $code The Exception code. |
|
34 | * @param \Exception $previous The previous exception used for the exception chaining. |
|
35 | */ |
|
36 | public function __construct(SocketInterface $socket, $message = '', $code = 0, \Exception $previous = null) |
|
37 | { |
|
38 | parent::__construct($message, $code, $previous); |
|
39 | $this->socket = $socket; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * Return socket with this exception |
|
44 | * |
|
45 | * @return SocketInterface |
|
46 | */ |
|
47 | public function getSocket() |
|
48 | { |
|
49 | return $this->socket; |
|
50 | } |
|
51 | } |
|
52 |
@@ 18-56 (lines=39) @@ | ||
15 | /** |
|
16 | * Class FrameException |
|
17 | */ |
|
18 | class FrameException extends NetworkSocketException |
|
19 | { |
|
20 | /** |
|
21 | * Failed FramePicker |
|
22 | * |
|
23 | * @var FramePickerInterface |
|
24 | */ |
|
25 | private $picker; |
|
26 | ||
27 | /** |
|
28 | * Construct the exception. |
|
29 | * |
|
30 | * @param FramePickerInterface $picker Corrupted framePicker |
|
31 | * @param SocketInterface $socket Socket object |
|
32 | * @param string $message The Exception message to throw. |
|
33 | * @param int $code The Exception code. |
|
34 | * @param \Exception $previous The previous exception used for the exception chaining. |
|
35 | */ |
|
36 | public function __construct( |
|
37 | FramePickerInterface $picker, |
|
38 | SocketInterface $socket, |
|
39 | $message = '', |
|
40 | $code = 0, |
|
41 | \Exception $previous = null |
|
42 | ) { |
|
43 | parent::__construct($socket, $message, $code, $previous); |
|
44 | $this->picker = $picker; |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * Return corrupted framePicker |
|
49 | * |
|
50 | * @return FramePickerInterface |
|
51 | */ |
|
52 | public function getFramePicker() |
|
53 | { |
|
54 | return $this->picker; |
|
55 | } |
|
56 | } |
|
57 |