DeletePriceListItemsBatch::getGuzzleOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Fousky\Component\iDoklad\Functions\PriceListItems;
4
5
use Fousky\Component\iDoklad\Functions\iDokladAbstractFunction;
6
use Fousky\Component\iDoklad\Model\PriceListItems\BatchModelOfInt32;
7
use Fousky\Component\iDoklad\Model\PriceListItems\BatchResultOfInt32;
8
9
/**
10
 * @see https://app.idoklad.cz/developer/Help/v2/cs/Api?apiId=DELETE-api-v2-PriceListItems-Batch-deleteIfReferenced
11
 *
12
 * @author Lukáš Brzák <[email protected]>
13
 */
14
class DeletePriceListItemsBatch extends iDokladAbstractFunction
15
{
16
    /** @var BatchModelOfInt32 $data */
17
    protected $data;
18
19
    /** @var bool $deleteIfReferenced */
20
    protected $deleteIfReferenced;
21
22
    /**
23
     * @param BatchModelOfInt32 $data
24
     * @param bool              $deleteIfReferenced
25
     *
26
     * @throws \Fousky\Component\iDoklad\Exception\InvalidModelException
27
     */
28
    public function __construct(BatchModelOfInt32 $data, bool $deleteIfReferenced = true)
29
    {
30
        $this->data = $data;
31
        $this->deleteIfReferenced = $deleteIfReferenced;
32
33
        $this->validate($data);
34
    }
35
36
    /**
37
     * Get iDokladModelInterface class.
38
     *
39
     * @see iDokladModelInterface
40
     *
41
     * @return string
42
     */
43
    public function getModelClass(): string
44
    {
45
        return BatchResultOfInt32::class;
46
    }
47
48
    /**
49
     * GET|POST|PUT|DELETE e.g.
50
     *
51
     * @see iDoklad::request()
52
     *
53
     * @return string
54
     */
55
    public function getHttpMethod(): string
56
    {
57
        return 'DELETE';
58
    }
59
60
    /**
61
     * Return base URI, e.g. /invoices; /invoice/1/edit and so on.
62
     *
63
     * @see iDoklad::call()
64
     *
65
     * @return string
66
     */
67
    public function getUri(): string
68
    {
69
        return sprintf(
70
            'PriceListItems/Batch/%s',
71
            true === $this->deleteIfReferenced ? 1 : 0
72
        );
73
    }
74
75
    /**
76
     * Vrátí seznam parametrů, které se předají GuzzleHttp\Client.
77
     *
78
     * @see \GuzzleHttp\Client::request()
79
     * @see iDoklad::call()
80
     *
81
     * @return array
82
     */
83
    public function getGuzzleOptions(): array
84
    {
85
        return [];
86
    }
87
}
88