| 1 |
<?php |
| 2 |
|
| 3 |
namespace ImportWP\Common\Importer\Parser; |
| 4 |
|
| 5 |
use ImportWP\Common\Importer\ParserInterface; |
| 6 |
|
| 7 |
class JSONParser extends AbstractParser implements ParserInterface |
| 8 |
{ |
| 9 |
/** |
| 10 |
* JSON Record |
| 11 |
* |
| 12 |
* @var array |
| 13 |
*/ |
| 14 |
private $json_record; |
| 15 |
|
| 16 |
public function query($query) |
| 17 |
{ |
| 18 |
return isset($this->json_record[$query]) ? $this->json_record[$query] : ''; |
| 19 |
} |
| 20 |
|
| 21 |
protected function onRecordLoaded() |
| 22 |
{ |
| 23 |
$this->json_record = json_decode($this->record, true); |
| 24 |
} |
| 25 |
|
| 26 |
public function record() |
| 27 |
{ |
| 28 |
return $this->json_record; |
| 29 |
} |
| 30 |
} |
| 31 |
|