-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResult.php
More file actions
73 lines (57 loc) · 1.36 KB
/
Result.php
File metadata and controls
73 lines (57 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace K2\UploadExcelBundle;
use K2\UploadExcelBundle\ExcelRowInterface;
class Result implements \IteratorAggregate
{
protected $data;
protected $invalids;
protected $headers;
function __construct($data = array())
{
foreach ($data as $row) {
$this->addRow($row);
}
}
public function getData()
{
return $this->data;
}
public function setData(array $data)
{
$this->data = $data;
}
public function getValids()
{
return (array) array_diff_key((array) $this->data, (array) $this->invalids);
}
public function getInvalids()
{
return (array) $this->invalids;
}
public function setInvalids(array $invalids)
{
$this->invalids = $invalids;
}
public function getHeaders()
{
return (array) $this->headers;
}
public function setHeaders(array $headers)
{
$this->headers = $headers;
}
public function addRow(ExcelRowInterface $excelRow)
{
$this->data[$excelRow->getNumRow()] = $excelRow;
return $this;
}
public function addRowInvalid(ExcelRowInterface $excelRow)
{
$this->invalids[$excelRow->getNumRow()] = $excelRow;
return $this;
}
public function getIterator()
{
return new \ArrayIterator($this->getData());
}
}