rawaby88 /
open-weather-laravel
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Rawaby88\OpenWeatherMap\Traits; |
||
| 4 | |||
| 5 | use Rawaby88\OpenWeatherMap\Services\Support\CurrentWeather; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Trait CWSingleResultTrait. |
||
| 9 | */ |
||
| 10 | trait CWSingleResultTrait |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array Hold query parameters for api call. |
||
| 14 | */ |
||
| 15 | protected $params; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string Part of the api link. |
||
| 19 | */ |
||
| 20 | protected $apiCall; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Return APi call result as CurrentWeather object. |
||
| 24 | * @return CurrentWeather |
||
| 25 | */ |
||
| 26 | public function get(): CurrentWeather |
||
| 27 | { |
||
| 28 | return new CurrentWeather($this->queryOrFail($this->apiCall, $this->params)); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 29 | } |
||
| 30 | } |
||
| 31 |