PairCashVoucherByInvoice::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Fousky\Component\iDoklad\Functions\CashVoucher;
4
5
use Fousky\Component\iDoklad\Functions\iDokladAbstractFunction;
6
use Fousky\Component\iDoklad\LOV\InvoiceTypeEnum;
7
use Fousky\Component\iDoklad\Model\Void\VoidModel;
8
9
/**
10
 * @see https://app.idoklad.cz/developer/Help/v2/cs/Api?apiId=POST-api-v2-CashVouchers-Pair-cashVoucherId-invoiceType-invoiceId
11
 *
12
 * @author Lukáš Brzák <[email protected]>
13
 */
14 View Code Duplication
class PairCashVoucherByInvoice extends iDokladAbstractFunction
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /** @var int $cashVoucherId */
17
    protected $cashVoucherId;
18
19
    /** @var InvoiceTypeEnum $invoiceType */
20
    protected $invoiceType;
21
22
    /** @var int $invoiceId */
23
    protected $invoiceId;
24
25
    /**
26
     * @param int $cashVoucherId
27
     * @param int $invoiceType
28
     * @param int $invoiceId
29
     */
30
    public function __construct(int $cashVoucherId, int $invoiceType, int $invoiceId)
31
    {
32
        $this->cashVoucherId = $cashVoucherId;
33
        $this->invoiceType = new InvoiceTypeEnum($invoiceType);
34
        $this->invoiceId = $invoiceId;
35
    }
36
37
    /**
38
     * Get iDokladModelInterface class.
39
     *
40
     * @see iDokladModelInterface
41
     *
42
     * @return string
43
     */
44
    public function getModelClass(): string
45
    {
46
        return VoidModel::class;
47
    }
48
49
    /**
50
     * GET|POST|PUT|DELETE e.g.
51
     *
52
     * @see iDoklad::request()
53
     *
54
     * @return string
55
     */
56
    public function getHttpMethod(): string
57
    {
58
        return 'POST';
59
    }
60
61
    /**
62
     * Return base URI, e.g. /invoices; /invoice/1/edit and so on.
63
     *
64
     * @see iDoklad::call()
65
     *
66
     * @return string
67
     */
68
    public function getUri(): string
69
    {
70
        return sprintf(
71
            'CashVouchers/Pair/%s/%s/%s',
72
            $this->cashVoucherId,
73
            $this->invoiceType->getValue(),
74
            $this->invoiceId
75
        );
76
    }
77
78
    /**
79
     * Vrátí seznam parametrů, které se předají GuzzleHttp\Client.
80
     *
81
     * @see \GuzzleHttp\Client::request()
82
     * @see iDoklad::call()
83
     *
84
     * @return array
85
     */
86
    public function getGuzzleOptions(): array
87
    {
88
        return [];
89
    }
90
}
91