Estimates   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 52
ccs 4
cts 4
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPriceEstimates() 0 4 1
A getTimeEstimates() 0 4 1
request() 0 1 ?
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);
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);
41
    }
42
43
    /**
44
     * Makes a request to the Uber API and returns the response.
45
     *
46
     * @param    string $verb       The Http verb to use
47
     * @param    string $path       The path of the APi after the domain
48
     * @param    array  $parameters Parameters
49
     *
50
     * @return   stdClass The JSON response from the request
51
     * @throws   Exception
52
     */
53
    abstract protected function request($verb, $path, $parameters = []);
54
}
55