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

Riders::getProfile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Stevenmaguire\Uber\Resources;
2
3
trait Riders
4
{
5
    /**
6
     * Lists history events for the current rider.
7
     *
8
     * The User Activity endpoint returns a limited amount of data about a
9
     * user's lifetime activity with Uber. The response will include pickup and
10
     * dropoff times, the distance of past requests, and information about
11
     * which products were requested.
12
     *
13
     * The history array in the response will have a maximum length based on
14
     * the limit parameter. The response value count may exceed limit,
15
     * therefore subsequent API requests may be necessary.
16
     *
17
     * @param    array    $attributes   Query attributes
18
     *
19
     * @return   stdClass               The JSON response from the request
20
     *
21
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/history-get
22
     */
23 2
    public function getHistory($attributes = [])
24
    {
25 2
        return $this->request('get', 'history', $attributes);
0 ignored issues
show
Bug introduced by
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...
26
    }
27
28
    /**
29
     * Lists available payment methods for the current rider.
30
     *
31
     * The Payment Methods endpoint allows retrieving the list of the user’s
32
     * available payment methods. These can be leveraged in order to supply a
33
     * payment_method_id to the POST /requests endpoint.
34
     *
35
     * @return   stdClass               The JSON response from the request
36
     *
37
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/payment-methods-get
38
     */
39 2
    public function getPaymentMethods()
40
    {
41 2
        return $this->request('get', 'payment-methods');
0 ignored issues
show
Bug introduced by
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...
42
    }
43
44
    /**
45
     * Fetches a specific place.
46
     *
47
     * The Places endpoint allows retrieving the home and work addresses from
48
     * an Uber user's profile.
49
     *
50
     * Only home and work are acceptable.
51
     *
52
     * @param    string   $placeId      Place id
53
     *
54
     * @return   stdClass               The JSON response from the request
55
     *
56
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-get
57
     */
58 2
    public function getPlace($placeId)
59
    {
60 2
        return $this->request('get', 'places/'.$placeId);
0 ignored issues
show
Bug introduced by
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...
61
    }
62
63
    /**
64
     * Fetches the profile for the current rider.
65
     *
66
     * The User Profile endpoint returns information about the Uber user that
67
     * has authorized with the application.
68
     *
69
     * @return   stdClass               The JSON response from the request
70
     *
71
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/me-get
72
     */
73 4
    public function getProfile()
74
    {
75 4
        return $this->request('get', 'me');
0 ignored issues
show
Bug introduced by
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...
76
    }
77
78
    /**
79
     * Updates a specific place.
80
     *
81
     * The Places endpoint allows updating the home and work addresses from an
82
     * Uber user's profile.
83
     *
84
     * Only home and work are acceptable.
85
     *
86
     * @param    string   $placeId      Place id
87
     * @param    array    $attributes   Query attributes
88
     *
89
     * @return   stdClass
90
     *
91
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-put
92
     */
93 2
    public function setPlace($placeId, $attributes = [])
94
    {
95 2
        return $this->request('put', 'places/'.$placeId, $attributes);
0 ignored issues
show
Bug introduced by
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...
96
    }
97
98
    /**
99
     * Updates the profile for the current rider.
100
     *
101
     * @param array $attributes
102
     *
103
     * @return   stdClass
104
     *
105
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/me-patch
106
     */
107 2
    public function setProfile($attributes = [])
108
    {
109 2
        return $this->request('put', 'me', $attributes);
0 ignored issues
show
Bug introduced by
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...
110
    }
111
}
112