PluginProbe
Import WP – CSV & XML Import Export for WordPress / trunk
Import WP – CSV & XML Import Export for WordPress vtrunk
2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 trunk 0.1.6 All 142 releases
jc-importer / class / Common / Importer / DataParser.php

DataParser.php in Import WP – CSV & XML Import Export for WordPress trunk, at class/Common/Importer/DataParser.php

57 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImportWP\Common\Importer;
4
5 /**
6 * Class DataParser
7 *
8 * Run all template queries on xml record.
9 *
10 * @package ImportWP\Common\Importer
11 */
12 class DataParser
13 {
14 private $config_data;
15
16 /**
17 * @var ParserInterface $parser
18 */
19 private $parser;
20
21 /**
22 * @var MapperInterface $mapper
23 */
24 private $mapper;
25
26 public function __construct(ParserInterface $parser, MapperInterface $mapper, $config_data)
27 {
28 $this->parser = $parser;
29 $this->config_data = $config_data;
30 $this->mapper = $mapper;
31 }
32
33 /**
34 * Get record from parser matching the template
35 *
36 * @param int $index
37 *
38 * @return ParsedData
39 */
40 public function get($index)
41 {
42
43 $parsed_data = new ParsedData($this->mapper);
44
45 if ($this->config_data) {
46 foreach ($this->config_data as $group) {
47 $data = $this->parser->getRecord($index)
48 ->queryGroup($group);
49
50 $parsed_data->add($data, $group);
51 }
52 }
53
54 return $parsed_data;
55 }
56 }
57