| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Rollbar\Payload; |
||
| 3 | class Body implements \Serializable |
||
| 4 | { |
||
| 5 | /** |
||
| 6 | * @var ContentInterface |
||
| 7 | */ |
||
| 8 | private $value; |
||
| 9 | private $utilities; |
||
| 10 | |||
| 11 | public function __construct(ContentInterface $value) |
||
| 12 | { |
||
| 13 | $this->utilities = new \Rollbar\Utilities(); |
||
| 14 | $this->setValue($value); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function getValue() |
||
| 20 | } |
||
| 21 | |||
| 22 | public function setValue(ContentInterface $value) |
||
| 23 | { |
||
| 24 | $this->value = $value; |
||
| 25 | return $this; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function serialize() |
||
| 29 | { |
||
| 30 | $result = array(); |
||
| 31 | $result[$this->value->getKey()] = $this->value; |
||
| 32 | return $this->utilities->serializeForRollbar($result); |
||
|
|
|||
| 33 | } |
||
| 34 | |||
| 35 | public function unserialize($serialized) |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: