@@ -128,7 +128,15 @@ private function executeQuery($query)
128
128
];
129
129
}
130
130
131
- $ comp = $ location ['components ' ];
131
+ $ comp = $ location ['components ' ];
132
+
133
+ $ adminLevels = [];
134
+ foreach (['state ' , 'county ' ] as $ i => $ component ) {
135
+ if (isset ($ comp [$ component ])) {
136
+ $ adminLevels [] = ['name ' => $ comp [$ component ], 'level ' => $ i + 1 ];
137
+ }
138
+ }
139
+
132
140
$ results [] = array_merge ($ this ->getDefaults (), array (
133
141
'latitude ' => $ location ['geometry ' ]['lat ' ],
134
142
'longitude ' => $ location ['geometry ' ]['lng ' ],
@@ -138,8 +146,7 @@ private function executeQuery($query)
138
146
'subLocality ' => isset ($ comp ['suburb ' ] ) ? $ comp ['suburb ' ] : null ,
139
147
'locality ' => isset ($ comp ['city ' ] ) ? $ comp ['city ' ] : null ,
140
148
'postalCode ' => isset ($ comp ['postcode ' ] ) ? $ comp ['postcode ' ] : null ,
141
- 'county ' => isset ($ comp ['county ' ] ) ? $ comp ['county ' ] : null ,
142
- 'region ' => isset ($ comp ['state ' ] ) ? $ comp ['state ' ] : null ,
149
+ 'adminLevels ' => $ adminLevels ,
143
150
'country ' => isset ($ comp ['country ' ] ) ? $ comp ['country ' ] : null ,
144
151
'countryCode ' => isset ($ comp ['country_code ' ]) ? strtoupper ($ comp ['country_code ' ]) : null ,
145
152
'timezone ' => isset ($ location ['annotations ' ]['timezone ' ]['name ' ]) ? $ location ['annotations ' ]['timezone ' ]['name ' ] : null ,
0 commit comments