CWSingleResultTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 4
c 2
b 1
f 0
dl 0
loc 19
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
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
It seems like queryOrFail() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        return new CurrentWeather($this->/** @scrutinizer ignore-call */ queryOrFail($this->apiCall, $this->params));
Loading history...
29
    }
30
}
31