@@ -101,7 +101,7 @@ class OpenWeatherMap
101
101
/**
102
102
* Constructs the OpenWeatherMap object.
103
103
*
104
- * @param string $apiKey The OpenWeatherMap API key. Required and only optional for BC .
104
+ * @param string $apiKey The OpenWeatherMap API key. Required.
105
105
* @param null|FetcherInterface $fetcher The interface to fetch the data from OpenWeatherMap. Defaults to
106
106
* CurlFetcher() if cURL is available. Otherwise defaults to
107
107
* FileGetContentsFetcher() using 'file_get_contents()'.
@@ -113,17 +113,14 @@ class OpenWeatherMap
113
113
*
114
114
* @api
115
115
*/
116
- public function __construct ($ apiKey = '' , $ fetcher = null , $ cache = false , $ seconds = 600 )
116
+ public function __construct ($ apiKey , $ fetcher = null , $ cache = false , $ seconds = 600 )
117
117
{
118
118
if (!is_string ($ apiKey ) || empty ($ apiKey )) {
119
- // BC
120
- $ seconds = $ cache !== false ? $ cache : 600 ;
121
- $ cache = $ fetcher !== null ? $ fetcher : false ;
122
- $ fetcher = $ apiKey !== '' ? $ apiKey : null ;
123
- } else {
124
- $ this ->apiKey = $ apiKey ;
119
+ throw new \InvalidArgumentException ("You must provide an API key. " );
125
120
}
126
121
122
+ $ this ->apiKey = $ apiKey ;
123
+
127
124
if ($ cache !== false && !($ cache instanceof AbstractCache)) {
128
125
throw new \InvalidArgumentException ('The cache class must implement the FetcherInterface! ' );
129
126
}
@@ -554,14 +551,6 @@ public function wasCached()
554
551
return $ this ->wasCached ;
555
552
}
556
553
557
- /**
558
- * @deprecated Use {@link self::getRawWeatherData()} instead.
559
- */
560
- public function getRawData ($ query , $ units = 'imperial ' , $ lang = 'en ' , $ appid = '' , $ mode = 'xml ' )
561
- {
562
- return $ this ->getRawWeatherData ($ query , $ units , $ lang , $ appid , $ mode );
563
- }
564
-
565
554
/**
566
555
* Fetches the result or delivers a cached version of the result.
567
556
*
0 commit comments