Completed
Push — master ( dbd16b...a17da9 )
by Steven
02:08
created

src/Resources/Estimates.php (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace Stevenmaguire\Uber\Resources;
2
3
trait Estimates
4
{
5
    /**
6
     * Fetches a price estimate.
7
     *
8
     * The Price Estimates endpoint returns an estimated price range for each
9
     * product offered at a given location. The price estimate is provided as
10
     * a formatted string with the full price range and the localized currency
11
     * symbol.
12
     *
13
     * @param    array    $attributes   Query attributes
14
     *
15
     * @return   stdClass               The JSON response from the request
16
     *
17
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/estimates-price-get
18
     */
19 2
    public function getPriceEstimates($attributes = [])
20
    {
21 2
        return $this->request('get', 'estimates/price', $attributes);
0 ignored issues
show
It seems like request() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
22
    }
23
24
    /**
25
     * Fetches a time estimate.
26
     *
27
     * The Time Estimates endpoint returns ETAs for all products offered at a
28
     * given location, with the responses expressed as integers in seconds. We
29
     * recommend that this endpoint be called every minute to provide the most
30
     * accurate, up-to-date ETAs.
31
     *
32
     * @param    array    $attributes   Query attributes
33
     *
34
     * @return   stdClass               The JSON response from the request
35
     *
36
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/estimates-time-get
37
     */
38 2
    public function getTimeEstimates($attributes = [])
39
    {
40 2
        return $this->request('get', 'estimates/time', $attributes);
0 ignored issues
show
It seems like request() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
41
    }
42
}
43