1 | <?php |
||
32 | class RemoteExceptionWrapper implements \Serializable |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * The original exception type. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $type = '\Exception'; |
||
41 | |||
42 | /** |
||
43 | * The exception code. |
||
44 | * |
||
45 | * @var integer |
||
46 | */ |
||
47 | protected $code = 0; |
||
48 | |||
49 | /** |
||
50 | * The filename where the exception was created. |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $file = ''; |
||
55 | |||
56 | /** |
||
57 | * The line where the exception was created. |
||
58 | * |
||
59 | * @var integer |
||
60 | */ |
||
61 | protected $line = 0; |
||
62 | |||
63 | /** |
||
64 | * The original exception stack trace. |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | protected $trace = ''; |
||
69 | |||
70 | /** |
||
71 | * The exception message. |
||
72 | * |
||
73 | * @var string |
||
74 | */ |
||
75 | protected $message = ''; |
||
76 | |||
77 | /** |
||
78 | * Initializes the wrapper with the data from the passed exception. |
||
79 | * |
||
80 | * @param \Exception $e The exception we want to wrap |
||
81 | */ |
||
82 | public function __construct(\Exception $e) |
||
92 | |||
93 | /** |
||
94 | * Factory method to create a new wrapper instance from the |
||
95 | * passed exception data. |
||
96 | * |
||
97 | * @param \Exception $e The exception to wrap |
||
98 | * |
||
99 | * @return \AppserverIo\RemoteMethodInvocation\RemoteExceptionWrapper The wrapper instance |
||
100 | */ |
||
101 | public function factory(\Exception $e) |
||
105 | |||
106 | /** |
||
107 | * This method has to be called to serialize the String. |
||
108 | * |
||
109 | * @return string Returns a serialized version of the String |
||
110 | * @see \Serializable::serialize() |
||
111 | */ |
||
112 | public function serialize() |
||
116 | |||
117 | /** |
||
118 | * This method unserializes the passed string and initializes the String |
||
119 | * itself with the data. |
||
120 | * |
||
121 | * @param string $data Holds the data of the instance as serialized string |
||
122 | * |
||
123 | * @return void |
||
124 | * @see \Serializable::unserialize($data) |
||
125 | */ |
||
126 | public function unserialize($data) |
||
132 | |||
133 | /** |
||
134 | * Returns a new instance of the original exception |
||
135 | * and it's data. |
||
136 | * |
||
137 | * @return \Exception An instance of the original exception |
||
138 | */ |
||
139 | public function toException() |
||
143 | } |
||
144 |