1 | <?php |
||
15 | abstract class AbstractArrayParser implements Parser { |
||
16 | |||
17 | /** |
||
18 | * @var ParserFactory |
||
19 | */ |
||
20 | protected $parserFactory; |
||
21 | |||
22 | /** |
||
23 | * AbstractParser constructor. |
||
24 | */ |
||
25 | public function __construct() { |
||
28 | |||
29 | /** |
||
30 | * Parse an array of entries loaded from eg. the Yaml- or JsonParser |
||
31 | * |
||
32 | * @param array $data |
||
33 | * |
||
34 | * @return mixed |
||
35 | * |
||
36 | * @see \Brendt\Stitcher\Parser\YamlParser |
||
37 | * @see \Brendt\Stitcher\Parser\JsonParser |
||
38 | */ |
||
39 | protected function parseArrayData(array $data) { |
||
48 | |||
49 | /** |
||
50 | * Parse a single entry. An entry has multiple fields with each of them a value. This value can either be a path |
||
51 | * to another data entry which will be parsed (using the ParserFactory); an array with a key `src` set, |
||
52 | * which refers to another data entry; or normal data which will be kept the way it was provided. |
||
53 | * |
||
54 | * After parsing all fields, an additional check is performed which sets the entry's ID if it wasn't set yet. |
||
55 | * Finally, an array with parsed fields, representing the entry, is returned. |
||
56 | * |
||
57 | * @param $id |
||
58 | * @param $entry |
||
59 | * |
||
60 | * @return array |
||
61 | * |
||
62 | * @see \Brendt\Stitcher\Factory\ParserFactory |
||
63 | */ |
||
64 | protected function parseEntryData($id, $entry) { |
||
82 | |||
83 | } |
||
84 |