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\Provider; |
13
|
|
|
|
14
|
|
|
use WBW\Library\Core\Exception\ApiException; |
15
|
|
|
use WBW\Library\GeoAPI\Model\Request\Departement\CommunesRequest; |
16
|
|
|
use WBW\Library\GeoAPI\Model\Request\Departement\DepartementsRequest; |
17
|
|
|
use WBW\Library\GeoAPI\Model\Response\CommunesResponse; |
18
|
|
|
use WBW\Library\GeoAPI\Model\Response\DepartementsResponse; |
19
|
|
|
use WBW\Library\GeoAPI\Serializer\DecoupageAdministratifResponseDeserializer; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Département provider. |
23
|
|
|
* |
24
|
|
|
* @author webeweb <https://github.com/webeweb/> |
25
|
|
|
* @package WBW\Library\GeoAPI\Provider |
26
|
|
|
*/ |
27
|
|
|
class DepartementProvider extends DecoupageAdministratifProvider { |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Communes. |
31
|
|
|
* |
32
|
|
|
* @param CommunesRequest $request The communes request. |
33
|
|
|
* @return CommunesResponse Returns the communes response. |
34
|
|
|
* @throws ApiException Throws an API exception if an error occurs. |
35
|
|
|
*/ |
36
|
|
|
public function communes(CommunesRequest $request) { |
37
|
|
|
|
38
|
|
|
$rawResponse = $this->callApi($request, []); |
39
|
|
|
|
40
|
|
|
return DecoupageAdministratifResponseDeserializer::deserializeCommunesResponse($rawResponse); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Départements. |
45
|
|
|
* |
46
|
|
|
* @param DepartementsRequest $request The départements request. |
47
|
|
|
* @return DepartementsResponse Returns the départements response. |
48
|
|
|
* @throws ApiException Throws an API exception if an error occurs. |
49
|
|
|
*/ |
50
|
|
|
public function departements(DepartementsRequest $request) { |
51
|
|
|
|
52
|
|
|
$rawResponse = $this->callApi($request, []); |
53
|
|
|
|
54
|
|
|
return DecoupageAdministratifResponseDeserializer::deserializeDepartementsResponse($rawResponse); |
55
|
|
|
} |
56
|
|
|
} |