@@ -211,7 +211,7 @@ |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * @param GoutteClient $client |
|
| 214 | + * @param Client $client |
|
| 215 | 215 | */ |
| 216 | 216 | public function setClient(Client $client) |
| 217 | 217 | { |
@@ -10,8 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace Th3Mouk\YahooWeatherAPI; |
| 12 | 12 | |
| 13 | -use Psr\Http\Message\ServerRequestInterface as Request; |
|
| 14 | -use Psr\Http\Message\ResponseInterface as Response; |
|
| 15 | 13 | use GuzzleHttp\Client; |
| 16 | 14 | use Th3Mouk\YahooWeatherAPI\Query\Query; |
| 17 | 15 | |
@@ -302,6 +302,9 @@ |
||
| 302 | 302 | return $service->getYql(); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | + /** |
|
| 306 | + * @param string $url |
|
| 307 | + */ |
|
| 305 | 308 | public function encodeURI($url) |
| 306 | 309 | { |
| 307 | 310 | $unescaped = array( |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $response = $service->callApiWoeid(null); |
| 34 | 34 | } |
| 35 | 35 | catch(\Exception $e) { |
| 36 | - throw $e; |
|
| 36 | + throw $e; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $response = $service->callApiCityName(null); |
| 49 | 49 | } |
| 50 | 50 | catch(\Exception $e) { |
| 51 | - throw $e; |
|
| 51 | + throw $e; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $response = $service->callApi(null); |
| 64 | 64 | } |
| 65 | 65 | catch(\Exception $e) { |
| 66 | - throw $e; |
|
| 66 | + throw $e; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $response = $service->callApi($errYql); |
| 81 | 81 | } |
| 82 | 82 | catch(\Exception $e) { |
| 83 | - throw $e; |
|
| 83 | + throw $e; |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $service = new YahooWeatherAPI(); |
| 141 | 141 | $yql = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="123456789")'; |
| 142 | - $url = 'https://query.yahooapis.com/v1/public/yql?q=' . $yql . '&format=json&env=store://datatables.org/alltableswithkeys'; |
|
| 142 | + $url = 'https://query.yahooapis.com/v1/public/yql?q='.$yql.'&format=json&env=store://datatables.org/alltableswithkeys'; |
|
| 143 | 143 | $url = $this->encodeURI($url); |
| 144 | 144 | $response = $service->callApi($url); |
| 145 | 145 | $this->assertSame($response, false); |
| 146 | 146 | |
| 147 | 147 | $yql = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="Taipei")'; |
| 148 | - $url = 'https://query.yahooapis.com/v1/public/yql?q=' . $yql . '&format=json&env=store://datatables.org/alltableswithkeys'; |
|
| 148 | + $url = 'https://query.yahooapis.com/v1/public/yql?q='.$yql.'&format=json&env=store://datatables.org/alltableswithkeys'; |
|
| 149 | 149 | $url = $this->encodeURI($url); |
| 150 | 150 | $response = $service->callApi($url); |
| 151 | 151 | $city = str_replace(' ', '', $response['location']['city']); |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')', |
| 306 | 306 | ); |
| 307 | 307 | $reserved = array( |
| 308 | - '%3B' => ';','%2C' => ',','%2F' => '/','%3F' => '?','%3A' => ':', |
|
| 309 | - '%40' => '@','%26' => '&','%3D' => '=','%2B' => '+','%24' => '$', |
|
| 308 | + '%3B' => ';', '%2C' => ',', '%2F' => '/', '%3F' => '?', '%3A' => ':', |
|
| 309 | + '%40' => '@', '%26' => '&', '%3D' => '=', '%2B' => '+', '%24' => '$', |
|
| 310 | 310 | ); |
| 311 | 311 | $score = array( |
| 312 | 312 | '%23' => '#', |