GetIssuedInvoicePdfWithPayments::getUri()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

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