|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the geo-api-library package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2020 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Library\GeoAPI\Model\Request\Adresse; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Search CSV request. |
|
16
|
|
|
* |
|
17
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
18
|
|
|
* @package WBW\Library\GeoAPI\Model\Request\Adresse |
|
19
|
|
|
*/ |
|
20
|
|
|
class SearchCsvRequest extends AbstractCsvRequest { |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Resource path. |
|
24
|
|
|
* |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
const RESOURCE_PATH = "/search/csv/"; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Columns. |
|
31
|
|
|
* |
|
32
|
|
|
* @var string[] |
|
33
|
|
|
*/ |
|
34
|
|
|
private $columns; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Result columns. |
|
38
|
|
|
* |
|
39
|
|
|
* @var string[] |
|
40
|
|
|
*/ |
|
41
|
|
|
private $resultColumns; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Constructor. |
|
45
|
|
|
* |
|
46
|
|
|
* @param string $data The data. |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct($data = null) { |
|
49
|
|
|
parent::__construct($data); |
|
50
|
|
|
$this->setColumns([]); |
|
51
|
|
|
$this->setResultColumns([]); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Add a column. |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $column The column. |
|
58
|
|
|
* @return SearchCsvRequest Returns this search CSV request. |
|
59
|
|
|
*/ |
|
60
|
|
|
public function addColumn($column) { |
|
61
|
|
|
$this->columns[] = $column; |
|
62
|
|
|
return $this; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Add a result column. |
|
67
|
|
|
* |
|
68
|
|
|
* @param string $resultColumn The result column. |
|
69
|
|
|
* @return SearchCsvRequest Returns this search CSV request. |
|
70
|
|
|
*/ |
|
71
|
|
|
public function addResultColumn($resultColumn) { |
|
72
|
|
|
$this->resultColumns[] = $resultColumn; |
|
73
|
|
|
return $this; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Get the columns. |
|
78
|
|
|
* |
|
79
|
|
|
* @return string[] Returns the columns. |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getColumns() { |
|
82
|
|
|
return $this->columns; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* {@inheritDoc} |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getResourcePath() { |
|
89
|
|
|
return self::RESOURCE_PATH; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Get the result columns. |
|
94
|
|
|
* |
|
95
|
|
|
* @return string[] Returns the result columns. |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getResultColumns() { |
|
98
|
|
|
return $this->resultColumns; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Set the columns. |
|
103
|
|
|
* |
|
104
|
|
|
* @param string[] $columns The columns. |
|
105
|
|
|
* @return SearchCsvRequest Returns this search CSV request. |
|
106
|
|
|
*/ |
|
107
|
|
|
public function setColumns($columns) { |
|
108
|
|
|
$this->columns = $columns; |
|
109
|
|
|
return $this; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Set the result columns. |
|
114
|
|
|
* |
|
115
|
|
|
* @param string[] $resultColumns The result columns. |
|
116
|
|
|
* @return SearchCsvRequest Returns this search CSV request. |
|
117
|
|
|
*/ |
|
118
|
|
|
protected function setResultColumns(array $resultColumns) { |
|
119
|
|
|
$this->resultColumns = $resultColumns; |
|
120
|
|
|
return $this; |
|
121
|
|
|
} |
|
122
|
|
|
} |