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

Reminders::createReminder()   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 1
crap 1
1
<?php namespace Stevenmaguire\Uber\Resources;
2
3
trait Reminders
4
{
5
    /**
6
     * Cancels a specific reminder.
7
     *
8
     * The Reminders endpoint allows you to remove any reminder in the pending
9
     * state from being sent.
10
     *
11
     * @param    string   $reminderId   Reminder id
12
     *
13
     * @return   stdClass               The JSON response from the request
14
     *
15
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete
16
     */
17 2
    public function cancelReminder($reminderId)
18
    {
19 2
        return $this->request('delete', 'reminders/'.$reminderId);
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...
20
    }
21
22
    /**
23
     * Creates a new reminder.
24
     *
25
     * The Reminders endpoint allows developers to set a reminder for a future
26
     * trip.
27
     *
28
     * @param    array    $attributes   Query attributes
29
     *
30
     * @return   stdClass               The JSON response from the request
31
     *
32
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-post
33
     */
34 2
    public function createReminder($attributes)
35
    {
36 2
        return $this->request('post', 'reminders', $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...
37
    }
38
39
    /**
40
     * Fetches a specific reminder.
41
     *
42
     * The Reminders endpoint allows you to get the status of an existing ride
43
     * reminder.
44
     *
45
     * @param    string   $reminderId   Reminder id
46
     *
47
     * @return   stdClass               The JSON response from the request
48
     *
49
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get
50
     */
51 2
    public function getReminder($reminderId)
52
    {
53 2
        return $this->request('get', 'reminders/'.$reminderId);
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...
54
    }
55
56
    /**
57
     * Updates a specific reminder.
58
     *
59
     * The Reminders endpoint allows you to update an existing reminder.
60
     *
61
     * @param string      $reminderId   Reminder id
62
     * @param array       $attributes   Query attributes
63
     *
64
     * @return  stdClass                The JSON response from the request
65
     *
66
     * @see     https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch
67
     */
68 2
    public function setReminder($reminderId, $attributes = [])
69
    {
70 2
        return $this->request('put', 'reminders/'.$reminderId, $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...
71
    }
72
}
73