1 | <?php |
||
7 | class Ngsc { |
||
8 | |||
9 | /** |
||
10 | * Instance of GuzzleHttp |
||
11 | * @var object |
||
12 | */ |
||
13 | protected $client; |
||
14 | |||
15 | /** |
||
16 | * Data response |
||
17 | * @var object |
||
18 | */ |
||
19 | protected $response; |
||
20 | |||
21 | /** |
||
22 | * Devcenter States and Cities API |
||
23 | * Source: http://states-cities.devcenter.co/ |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $baseUrl = 'http://states-cities.devcenter.co/api/v1'; |
||
27 | |||
28 | public function __construct() |
||
32 | |||
33 | /** |
||
34 | * Set options for making the Client request |
||
35 | * @return void |
||
36 | */ |
||
37 | private function setRequestOptions() |
||
41 | |||
42 | /** |
||
43 | * Make the client request and get the response |
||
44 | * @param string $relativeUrl |
||
45 | * @return void |
||
46 | */ |
||
47 | public function setResponse($relativeUrl) |
||
51 | |||
52 | /** |
||
53 | * Get an associative array of all the states and their cities |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getAllStates() |
||
62 | |||
63 | /** |
||
64 | * Get the details of a state |
||
65 | * @param string $state |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getOneState($state) |
||
74 | |||
75 | /** |
||
76 | * Get the local government areas of a particular state |
||
77 | * @param string $state |
||
78 | * @return array |
||
79 | */ |
||
80 | public function getLGAS($state) |
||
86 | |||
87 | /** |
||
88 | * Get all the cities of a particular state |
||
89 | * @param string $state |
||
90 | * @return array |
||
91 | */ |
||
92 | public function getCities($state) |
||
98 | |||
99 | /** |
||
100 | * Get the details of the required request |
||
101 | * @return object |
||
102 | */ |
||
103 | private function data() |
||
119 | } |