1 | <?php |
||
14 | class ValidatorIterator extends \IteratorIterator |
||
15 | { |
||
16 | /** |
||
17 | * Si la ligne est validée |
||
18 | * |
||
19 | * @var bool |
||
20 | */ |
||
21 | private $valid; |
||
22 | |||
23 | /** |
||
24 | * Si l'import va réaliser uniquement des insert, le type sera "insert" sinon "update" |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $lineType; |
||
29 | |||
30 | /** |
||
31 | * |
||
32 | * @var integer |
||
33 | */ |
||
34 | private $totalInsert = 0; |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * @var Integer |
||
39 | */ |
||
40 | private $totalUpdate = 0; |
||
41 | |||
42 | /** |
||
43 | * |
||
44 | * @var integer |
||
45 | */ |
||
46 | private $totalErrors = 0; |
||
47 | |||
48 | /* |
||
49 | * *************************** |
||
50 | * GETTERS |
||
51 | * *************************** |
||
52 | */ |
||
53 | |||
54 | /** |
||
55 | * |
||
56 | * @return bool |
||
57 | */ |
||
58 | 1 | public function getValid() |
|
62 | |||
63 | /** |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public function getType() |
|
71 | |||
72 | /** |
||
73 | * |
||
74 | * @return int |
||
75 | */ |
||
76 | 1 | public function getTotalUpdate() |
|
80 | |||
81 | /** |
||
82 | * |
||
83 | * @return int |
||
84 | */ |
||
85 | 1 | public function getTotalInsert() |
|
89 | |||
90 | /** |
||
91 | * |
||
92 | * @return int |
||
93 | */ |
||
94 | 1 | public function getTotalErrors() |
|
98 | |||
99 | /** |
||
100 | * @return mixed |
||
101 | * @throws Exception |
||
102 | */ |
||
103 | 2 | public function current() |
|
127 | |||
128 | /** |
||
129 | * Increase update/insert counter depending on type |
||
130 | * @param string $type |
||
131 | * @return $this |
||
132 | */ |
||
133 | 1 | protected function increaseCounter($type) |
|
142 | } |
||
143 |