Passed
Push — master ( 263c14...2fa329 )
by Jhao
02:31
created

FindBatchRequest::perPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), greabock (https://github.com/greabock), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Batches\Requests;
15
16
use Appwilio\RussianPostSDK\Core\Arrayable;
17
use Appwilio\RussianPostSDK\Dispatching\Enum\MailType;
18
use Appwilio\RussianPostSDK\Dispatching\Enum\MailCategory;
19
20
final class FindBatchRequest implements Arrayable
21
{
22
    private $data = [];
23
24
    public static function create(): self
25
    {
26
        return new self();
27
    }
28
29
    public function ofMailCategory(MailCategory $category)
30
    {
31
        $this->data['mailCategory'] = $category;
32
33
        return $this;
34
    }
35
36
    public function ofMailType(MailType $type)
37
    {
38
        $this->data['mailType'] = $type;
39
40
        return $this;
41
    }
42
43
    public function sortAsc()
44
    {
45
        $this->data['sort'] = 'asc';
46
47
        return $this;
48
    }
49
50
    public function sortDesc()
51
    {
52
        $this->data['sort'] = 'desc';
53
54
        return $this;
55
    }
56
57
    public function page(int $page)
58
    {
59
        $this->data['page'] = $page;
60
61
        return $this;
62
    }
63
64
    public function perPage(int $number)
65
    {
66
        $this->data['size'] = $number;
67
68
        return $this;
69
    }
70
71
    public function toArray(): array
72
    {
73
        return $this->data;
74
    }
75
}
76