• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

antistatique / realforce-php-sdk / 18361589630

30 Sep 2025 02:20PM UTC coverage: 87.264%. Remained the same
18361589630

push

github

web-flow
Merge pull request #1 from antistatique/feature/support-locations-city-labels

add support for Locations City labels

4 of 8 new or added lines in 1 file covered. (50.0%)

16 existing lines in 1 file now uncovered.

185 of 212 relevant lines covered (87.26%)

22.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.26
/src/Request/LocationsRequest.php
1
<?php
2

3
namespace Antistatique\Realforce\Request;
4

5
/**
6
 * Request object for Locations labels.
7
 *
8
 * @see \Antistatique\Realforce\Resource\PublicProperties
9
 */
10
final class LocationsRequest
11
{
12
    /**
13
     * Retrieve a list of countries.
14
     *
15
     * @var bool
16
     */
17
    private bool $isCountry = false;
18

19
    /**
20
     * Retrieve a list of cantons.
21
     *
22
     * @var bool
23
     */
24
    private bool $isCanton = false;
25

26
    /**
27
     * Retrieve a list of districts.
28
     *
29
     * @var bool
30
     */
31
    private bool $isDistrict = false;
32

33
    /**
34
     * Retrieve a list of zones.
35
     *
36
     * @var bool
37
     */
38
    private bool $isZone = false;
39

40
    /**
41
     * Retrieve a list of quarter.
42
     *
43
     * @var bool
44
     */
45
    private bool $isQuarter = false;
46

47
    /**
48
     * Retrieve a list of city.
49
     *
50
     * @var bool
51
     */
52
    private bool $isCity = false;
53

54
    /**
55
     * ID of a country to filter on.
56
     *
57
     * @var int|null
58
     */
59
    private ?int $countryId = null;
60

61
    /**
62
     * ID of a canton to filter on.
63
     *
64
     * @var int|null
65
     */
66
    private ?int $cantonId = null;
67

68
    /**
69
     * ID of a district to filter on.
70
     *
71
     * @var int|null
72
     */
73
    private ?int $districtId = null;
74

75
    /**
76
     * ID of a zone to filter on.
77
     *
78
     * @var int|null
79
     */
80
    private ?int $zoneId = null;
81

82
    /**
83
     * ID of a quarter to filter on.
84
     *
85
     * @var int|null
86
     */
87
    private ?int $quarterId = null;
88

89
    /**
90
     * ID of a city to filter on.
91
     *
92
     * @var int|null
93
     */
94
    private ?int $cityId = null;
95

96
    /**
97
     * Content languages in lower case (fr, en, it, de).
98
     *
99
     * Multiple languages can be retrieved using the "pipe" (|) separator.
100
     *
101
     * @var string
102
     */
103
    private string $lang;
104

105
    /**
106
     * Set to retrieve a list of countries.
107
     */
108
    public function isCountry(): self
109
    {
110
        $this->isCountry = true;
2✔
111

112
        return $this;
2✔
113
    }
114

115
    /**
116
     * Set to retrieve a list of cantons.
117
     */
118
    public function isCanton(): self
119
    {
UNCOV
120
        $this->isCanton = true;
×
121

UNCOV
122
        return $this;
×
123
    }
124

125
    /**
126
     * Set to retrieve a list of districts.
127
     */
128
    public function isDistrict(): self
129
    {
UNCOV
130
        $this->isDistrict = true;
×
131

UNCOV
132
        return $this;
×
133
    }
134

135
    /**
136
     * Set to retrieve a list of zones.
137
     */
138
    public function isZone(): self
139
    {
UNCOV
140
        $this->isZone = true;
×
141

UNCOV
142
        return $this;
×
143
    }
144

145
    /**
146
     * Set to retrieve a list of quarter.
147
     */
148
    public function isQuarter(): self
149
    {
UNCOV
150
        $this->isQuarter = true;
×
151

UNCOV
152
        return $this;
×
153
    }
154

155
    /**
156
     * Set to retrieve a list of city.
157
     */
158
    public function isCity(): self
159
    {
NEW
160
        $this->isCity = true;
×
161

NEW
162
        return $this;
×
163
    }
164

165
    /**
166
     * Set country ID to filter on.
167
     */
168
    public function countryId(int $countryId): self
169
    {
170
        $this->countryId = $countryId;
2✔
171

172
        return $this;
2✔
173
    }
174

175
    /**
176
     * Set canton ID to filter on.
177
     */
178
    public function cantonId(int $cantonId): self
179
    {
UNCOV
180
        $this->cantonId = $cantonId;
×
181

UNCOV
182
        return $this;
×
183
    }
184

185
    /**
186
     * Set district ID to filter on.
187
     */
188
    public function districtId(int $districtId): self
189
    {
UNCOV
190
        $this->districtId = $districtId;
×
191

UNCOV
192
        return $this;
×
193
    }
194

195
    /**
196
     * Set zone ID to filter on.
197
     */
198
    public function zoneId(int $zoneId): self
199
    {
UNCOV
200
        $this->zoneId = $zoneId;
×
201

UNCOV
202
        return $this;
×
203
    }
204

205
    /**
206
     * Set quarter ID to filter on.
207
     */
208
    public function quarterId(int $quarterId): self
209
    {
UNCOV
210
        $this->quarterId = $quarterId;
×
211

UNCOV
212
        return $this;
×
213
    }
214

215
    /**
216
     * Set city ID to filter on.
217
     */
218
    public function cityId(int $cityID): self
219
    {
NEW
220
        $this->cityId = $cityID;
×
221

NEW
222
        return $this;
×
223
    }
224

225
    /**
226
     * Set content languages (fr, en, it, de).
227
     */
228
    public function lang(array $lang): self
229
    {
230
        $this->lang = implode('|', $lang);
32✔
231

232
        return $this;
32✔
233
    }
234

235
    /**
236
     * Convert the request to an array for API consumption.
237
     */
238
    public function toArray(): array
239
    {
240
        $params = [];
84✔
241

242
        $params['lang'] = $this->lang;
84✔
243

244
        if ($this->isCountry) {
82✔
245
            $params['is_country'] = 1;
10✔
246
        }
247

248
        if ($this->isCanton) {
82✔
249
            $params['is_canton'] = 1;
6✔
250
        }
251

252
        if ($this->isDistrict) {
82✔
253
            $params['is_district'] = 1;
4✔
254
        }
255

256
        if ($this->isZone) {
82✔
257
            $params['is_zone'] = 1;
4✔
258
        }
259

260
        if ($this->isQuarter) {
82✔
261
            $params['is_quarter'] = 1;
4✔
262
        }
263

264
        if ($this->isCity) {
82✔
265
            $params['is_city'] = 1;
4✔
266
        }
267

268
        if (null !== $this->countryId) {
82✔
269
            $params['country_id'] = $this->countryId;
12✔
270
        }
271

272
        if (null !== $this->cantonId) {
82✔
273
            $params['canton_id'] = $this->cantonId;
8✔
274
        }
275

276
        if (null !== $this->districtId) {
82✔
277
            $params['district_id'] = $this->districtId;
6✔
278
        }
279

280
        if (null !== $this->zoneId) {
82✔
281
            $params['zone_id'] = $this->zoneId;
6✔
282
        }
283

284
        if (null !== $this->quarterId) {
82✔
285
            $params['quarter_id'] = $this->quarterId;
6✔
286
        }
287

288
        if (null !== $this->cityId) {
82✔
289
            $params['city_id'] = $this->cityId;
4✔
290
        }
291

292
        return $params;
82✔
293
    }
294
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc