| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Json extends AbstractComponent { |
||
| 6 | |||
| 7 | protected $json; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @param string $json |
||
| 11 | * @return bool |
||
| 12 | */ |
||
| 13 | public function __construct($json) |
||
| 14 | { |
||
| 15 | if (empty($json)) { |
||
| 16 | return false; |
||
| 17 | } |
||
| 18 | |||
| 19 | $object = json_decode($json); |
||
| 20 | if ($object instanceof \stdClass) { |
||
| 21 | $this->setJson($object); |
||
| 22 | return true; |
||
| 23 | } |
||
| 24 | |||
| 25 | return false; |
||
| 26 | } |
||
| 27 | |||
| 28 | private function setJson($json) |
||
| 29 | { |
||
| 30 | $this->json = $json; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getComponent() |
||
| 36 | } |
||
| 37 | } |