File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/Syntax/SteamApi/Containers Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -84,20 +84,21 @@ protected function getLocation()
8484 $ countriesFile = json_decode (\file_get_contents (__DIR__ . '/../Resources/countries.json ' ));
8585 $ result = new \stdClass ;
8686
87- if ($ this ->locCountryCode != null ) {
87+ if ($ this ->locCountryCode != null && isset ( $ countriesFile ->{ $ this -> locCountryCode }) ) {
8888 $ result ->country = $ countriesFile ->{$ this ->locCountryCode }->name ;
89- }
9089
91- if ($ this ->locCountryCode != null && $ this ->locStateCode != null ) {
92- $ result ->state = $ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->name ;
93- }
90+ if ($ this ->locStateCode != null && isset ( $ countriesFile ->{ $ this ->locCountryCode }-> states ->{ $ this -> locStateCode }) ) {
91+ $ result ->state = $ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->name ;
92+ }
9493
95- if ($ this ->locCountryCode != null && $ this ->locStateCode != null && $ this ->locCityId != null ) {
96- if (! empty ($ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->cities )) {
97- $ result ->city = $ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->cities ->{$ this ->locCityId }->name ;
94+ if ($ this ->locCityId != null && isset ($ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }) && ! empty ($ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->cities )) {
95+ if (isset ($ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->cities ->{$ this ->locCityId }))
96+ {
97+ $ result ->city = $ countriesFile ->{$ this ->locCountryCode }->states ->{$ this ->locStateCode }->cities ->{$ this ->locCityId }->name ;
98+ }
9899 }
99100 }
100-
101+
101102 return $ result ;
102103 }
103104
You can’t perform that action at this time.
0 commit comments