private function buildQueryUrlParameter($query)
    {
        switch ($query) {
            case is_array($query) && isset($query['lat']) && isset($query['lon']) && is_numeric($query['lat']) && is_numeric($query['lon']):
                return "lat={$query['lat']}&lon={$query['lon']}";
            case is_array($query) && is_numeric($query[0]):
                return 'id='.implode(',', $query);
            case is_numeric($query):
                return "id=$query";
            case is_string($query) && strpos($query, 'zip:') === 0:
                $subQuery = str_replace('zip:', '', $query);
                return 'zip='.urlencode($subQuery);
            case is_string($query):
                return 'q='.urlencode($query);
            default:
                throw new \InvalidArgumentException('Error: $query has the wrong format. See the documentation of OpenWeatherMap::getWeather() to read about valid formats.');
        }
    }
private function buildQueryUrlParameter($query)
    {
        switch ($query) {
            case is_array($query) && isset($query['lat']) && isset($query['lon']) && is_numeric($query['lat']) && is_numeric($query['lon']):
                return "lat={$query['lat']}&lon={$query['lon']}";
            case is_array($query) && is_numeric($query[0]):
                return 'id='.implode(',', $query);
            case is_numeric($query):
                return "id=$query";
            case is_string($query) && strpos($query, 'zip:') === 0:
                $subQuery = str_replace('zip:', '', $query);
                return 'zip='.urlencode($subQuery);
            case is_string($query):
                return 'q='.urlencode($query);
            default:
                throw new \InvalidArgumentException('Error: $query has the wrong format. See the documentation of OpenWeatherMap::getWeather() to read about valid formats.');
        }
    }
private function buildQueryUrlParameter ( $ query ) { switch ( $ query ) { case is_array ( $ query ) && isset ( $ query [ 'lat' ] ) && isset ( $ query [ 'lon' ] ) && is_numeric ( $ query [ 'lat' ] ) && is_numeric ( $ query [ 'lon' ] ) : return "lat={$query['lat']}&lon={$query['lon']}" ; case is_array ( $ query ) && is_numeric ( $ query [ 0 ] ) : return 'id=' . implode ( ',' , $ query ) ; case is_numeric ( $ query ) : return "id=$query" ; case is_string ( $ query ) && strpos ( $ query , 'zip:' ) === 0 : $ subQuery = str_replace ( 'zip:' , '' , $ query ) ; return 'zip=' . urlencode ( $ subQuery ) ; case is_string ( $ query ) : return 'q=' . urlencode ( $ query ) ; default : throw new \ InvalidArgumentException ( 'Error: $query has the wrong format. See the documentation of OpenWeatherMap::getWeather() to read about valid formats.' ) ; } }
Builds the query string for the url.

@param mixed $query

@return string The built query string for the url.

@throws \InvalidArgumentException If the query parameter is invalid.
Builds the query string for the url .