Completed
Push — master ( 0adf01...5e9615 )
by WEBEWEB
01:11
created

AbstractCsvResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Response\Adresse;
13
14
use WBW\Library\GeoAPI\Model\AbstractResponse;
15
use WBW\Library\GeoAPI\Model\Adresse\Adresse;
16
17
/**
18
 * Abstract CVS response.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Library\GeoAPI\Model\Response\Adresse
22
 * @abstract
23
 */
24
abstract class AbstractCsvResponse extends AbstractResponse {
25
26
    /**
27
     * Result "city".
28
     *
29
     * @var string
30
     */
31
    const RESULT_CITY = "result_city";
32
33
    /**
34
     * Result "city code".
35
     *
36
     * @var string
37
     */
38
    const RESULT_CITYCODE = "result_citycode";
39
40
    /**
41
     * Result "context".
42
     *
43
     * @var string
44
     */
45
    const RESULT_CONTEXT = "result_context";
46
47
    /**
48
     * Result "distance".
49
     *
50
     * @var string
51
     */
52
    const RESULT_DISTANCE = "result_distance";
53
54
    /**
55
     * Result "district".
56
     *
57
     * @var string
58
     */
59
    const RESULT_DISTRICT = "result_district";
60
61
    /**
62
     * Result "house number".
63
     *
64
     * @var string
65
     */
66
    const RESULT_HOUSENUMBER = "result_housenumber";
67
68
    /**
69
     * Result "id".
70
     *
71
     * @var string
72
     */
73
    const RESULT_ID = "result_id";
74
75
    /**
76
     * Result "label".
77
     *
78
     * @var string
79
     */
80
    const RESULT_LABEL = "result_label";
81
82
    /**
83
     * Result "latitude".
84
     *
85
     * @var string
86
     */
87
    const RESULT_LATITUDE = "result_latitude";
88
89
    /**
90
     * Result "longitude".
91
     *
92
     * @var string
93
     */
94
    const RESULT_LONGITUDE = "result_longitude";
95
96
    /**
97
     * Result "name".
98
     *
99
     * @var string
100
     */
101
    const RESULT_NAME = "result_name";
102
103
    /**
104
     * Result "old city".
105
     *
106
     * @var string
107
     */
108
    const RESULT_OLDCITY = "result_oldcity";
109
110
    /**
111
     * Result "old city code".
112
     *
113
     * @var string
114
     */
115
    const RESULT_OLDCITYCODE = "result_oldcitycode";
116
117
    /**
118
     * Result "postcode".
119
     *
120
     * @var string
121
     */
122
    const RESULT_POSTCODE = "result_postcode";
123
124
    /**
125
     * Result "score".
126
     *
127
     * @var string
128
     */
129
    const RESULT_SCORE = "result_score";
130
131
    /**
132
     * Result "street".
133
     *
134
     * @var string
135
     */
136
    const RESULT_STREET = "result_street";
137
138
    /**
139
     * Result "type".
140
     *
141
     * @var string
142
     */
143
    const RESULT_TYPE = "result_type";
144
145
    /**
146
     * Adresses.
147
     *
148
     * @var Adresse[]
149
     */
150
    private $adresses;
151
152
    /**
153
     * Constructor.
154
     */
155
    public function __construct() {
156
        $this->setAdresses([]);
157
    }
158
159
    /**
160
     * Add an adresse.
161
     *
162
     * @param Adresse $adresse The adresse.
163
     * @return AbstractCsvResponse Returns this CSV response.
164
     */
165
    public function addAdresse(Adresse $adresse) {
166
        $this->adresses[] = $adresse;
167
        return $this;
168
    }
169
170
    /**
171
     * Enumerates the result columns.
172
     *
173
     * @return string[] Returns the result columns.
174
     */
175
    public static function enumResultColumns() {
176
        return [
177
            self::RESULT_CITY,
178
            self::RESULT_CITYCODE,
179
            self::RESULT_CONTEXT,
180
            self::RESULT_DISTANCE,
181
            self::RESULT_DISTRICT,
182
            self::RESULT_HOUSENUMBER,
183
            self::RESULT_ID,
184
            self::RESULT_LABEL,
185
            self::RESULT_LATITUDE,
186
            self::RESULT_LONGITUDE,
187
            self::RESULT_NAME,
188
            self::RESULT_OLDCITY,
189
            self::RESULT_OLDCITYCODE,
190
            self::RESULT_POSTCODE,
191
            self::RESULT_SCORE,
192
            self::RESULT_STREET,
193
            self::RESULT_TYPE,
194
        ];
195
    }
196
197
    /**
198
     * Get the adresses.
199
     *
200
     * @return Adresse[] Returns the adresses.
201
     */
202
    public function getAdresses() {
203
        return $this->adresses;
204
    }
205
206
    /**
207
     * Set the adresses.
208
     *
209
     * @param Adresse[] $adresses The adresses.
210
     * @return AbstractCsvResponse Returns this CSV response.
211
     */
212
    protected function setAdresses(array $adresses) {
213
        $this->adresses = $adresses;
214
        return $this;
215
    }
216
217
}