JuKu /
JuKuCMS
| 1 | <?php namespace Rollbar\Payload; |
||
| 2 | |||
| 3 | class Context implements \Serializable |
||
| 4 | { |
||
| 5 | private $pre; |
||
| 6 | private $post; |
||
| 7 | private $utilities; |
||
| 8 | |||
| 9 | public function __construct($pre, $post) |
||
| 10 | { |
||
| 11 | $this->utilities = new \Rollbar\Utilities(); |
||
| 12 | $this->setPre($pre); |
||
| 13 | $this->setPost($post); |
||
| 14 | } |
||
| 15 | |||
| 16 | public function getPre() |
||
| 17 | { |
||
| 18 | return $this->pre; |
||
| 19 | } |
||
| 20 | |||
| 21 | public function setPre($pre) |
||
| 22 | { |
||
| 23 | $this->pre = $pre; |
||
| 24 | return $this; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getPost() |
||
| 28 | { |
||
| 29 | return $this->post; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function setPost($post) |
||
| 33 | { |
||
| 34 | $this->post = $post; |
||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function serialize() |
||
| 39 | { |
||
| 40 | $result = array( |
||
| 41 | "pre" => $this->pre, |
||
| 42 | "post" => $this->post, |
||
| 43 | ); |
||
| 44 | return $this->utilities->serializeForRollbar($result); |
||
|
0 ignored issues
–
show
|
|||
| 45 | } |
||
| 46 | |||
| 47 | public function unserialize($serialized) |
||
| 48 | { |
||
| 49 | throw new \Exception('Not implemented yet.'); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: