| 1 | <?php namespace Stevenmaguire\Uber\Resources; |
||
| 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 = []) |
|
| 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 = []) |
|
| 42 | } |
||
| 43 |
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
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). 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.