GetDefaultIssuedDocumentPayment   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 62
loc 62
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A getModelClass() 4 4 1
A getHttpMethod() 4 4 1
A getUri() 4 4 1
A getGuzzleOptions() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Fousky\Component\iDoklad\Functions\IssuedDocumentPayments;
4
5
use Fousky\Component\iDoklad\Functions\iDokladAbstractFunction;
6
use Fousky\Component\iDoklad\Model\IssuedDocumentPayments\IssuedDocumentPaymentApiModelInsert;
7
8
/**
9
 * @author Lukáš Brzák <[email protected]>
10
 */
11 View Code Duplication
class GetDefaultIssuedDocumentPayment 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...
12
{
13
    /** @var string $documentId */
14
    protected $documentId;
15
16
    /**
17
     * @param string $documentId
18
     */
19
    public function __construct(string $documentId)
20
    {
21
        $this->documentId = $documentId;
22
    }
23
24
    /**
25
     * Get iDokladModelInterface class.
26
     *
27
     * @see iDokladModelInterface
28
     *
29
     * @return string
30
     */
31
    public function getModelClass(): string
32
    {
33
        return IssuedDocumentPaymentApiModelInsert::class;
34
    }
35
36
    /**
37
     * GET|POST|PUT|DELETE e.g.
38
     *
39
     * @see iDoklad::request()
40
     *
41
     * @return string
42
     */
43
    public function getHttpMethod(): string
44
    {
45
        return 'GET';
46
    }
47
48
    /**
49
     * Return base URI, e.g. /invoices; /invoice/1/edit and so on.
50
     *
51
     * @see iDoklad::call()
52
     *
53
     * @return string
54
     */
55
    public function getUri(): string
56
    {
57
        return sprintf('IssuedDocumentPayments/Default/%s', $this->documentId);
58
    }
59
60
    /**
61
     * Vrátí seznam parametrů, které se předají GuzzleHttp\Client.
62
     *
63
     * @see \GuzzleHttp\Client::request()
64
     * @see iDoklad::call()
65
     *
66
     * @return array
67
     */
68
    public function getGuzzleOptions(): array
69
    {
70
        return [];
71
    }
72
}
73