MessagesRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A limit() 0 3 1
A query() 0 3 1
1
<?php
2
3
namespace StephaneCoinon\SendGridActivity\Requests;
4
5
use StephaneCoinon\SendGridActivity\Requests\Request;
6
use StephaneCoinon\SendGridActivity\Responses\Message;
7
8
/**
9
 * Request builder for "/messages" endpoint.
10
 *
11
 * @see https://sendgrid.api-docs.io/v3.0/email-activity/filter-all-messages
12
 */
13
class MessagesRequest extends Request
14
{
15
    protected $endpoint = 'messages';
16
17
    protected $response = Message::class;
18
19
    /**
20
     * The parameter named "query" in the query string.
21
     *
22
     * It is encoded separately from the other parameters on the query string.
23
     *
24
     * @var string
25
     */
26
    protected $query = '';
27
28
    public function __construct()
29
    {
30
        $this->limit(10);
31
    }
32
33
    /**
34
     * Set the number of results returned per page.
35
     *
36
     * @param  int $limit
37
     * @return self
38
     */
39
    public function limit($limit): self
40
    {
41
        return $this->withParameter('limit', $limit);
42
    }
43
44
    /**
45
     * Set the "query" parameter.
46
     *
47
     * @param  string $query
48
     * @return self
49
     */
50
    public function query(string $query): self
51
    {
52
        return $this->withParameter('query', $query);
53
    }
54
}
55