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