Completed
Push — master ( d60f81...d9c7b0 )
by Viacheslav
02:04
created

KassaApi::getOrders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 19
ccs 10
cts 10
cp 1
rs 9.9666
cc 1
nc 1
nop 7
crap 1
1
<?php
2
3
4
namespace slavkluev\Bizon365\Api;
5
6
use slavkluev\Bizon365\Helpers\UrlHelper;
7
8
class KassaApi extends AbstractApi
9
{
10
    const METHODS = [
11
        'get.orders' => 'kassa/orders/getorders',
12
    ];
13
14 3
    public function getOrdersBySearch(
15
        string $search,
16
        int $skip = null,
17
        int $limit = null,
18
        bool $paid = null
19
    ) {
20 3
        return $this->getOrders(
21 3
            $skip,
22 2
            $limit,
23 3
            null,
24 3
            null,
25 3
            null,
26 2
            $paid,
27 2
            $search
28
        );
29
    }
30
31 3
    public function getOrdersByDays(
32
        int $days,
33
        int $skip = null,
34
        int $limit = null,
35
        bool $paid = null
36
    ) {
37 3
        return $this->getOrders(
38 3
            $skip,
39 2
            $limit,
40 2
            $days,
41 3
            null,
42 3
            null,
43 2
            $paid,
44 3
            null
45
        );
46
    }
47
48 3
    public function getOrdersByDate(
49
        string $dateBegin,
50
        string $dateEnd,
51
        int $skip = null,
52
        int $limit = null,
53
        bool $paid = null
54
    ) {
55 3
        return $this->getOrders(
56 3
            $skip,
57 2
            $limit,
58 3
            null,
59 2
            $dateBegin,
60 2
            $dateEnd,
61 2
            $paid,
62 3
            null
63
        );
64
    }
65
66 12
    public function getOrders(
67
        int $skip = null,
68
        int $limit = null,
69
        int $days = null,
70
        string $dateBegin = null,
71
        string $dateEnd = null,
72
        bool $paid = null,
73
        string $search = null
74
    ) {
75 12
        $url = UrlHelper::build(self::METHODS['get.orders'], [
76 12
            'skip'      => $skip,
77 12
            'limit'     => $limit,
78 12
            'days'      => $days,
79 12
            'dateBegin' => $dateBegin,
80 12
            'dateEnd'   => $dateEnd,
81 12
            'paid'      => $paid,
82 12
            'search'    => $search,
83
        ]);
84 12
        return $this->get($url);
85
    }
86
}
87