Passed
Branch master (633cc1)
by Andrey
07:17 queued 03:40
created

ScanSheet::insertDocuments()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Daaner\NovaPoshta\Models;
4
5
use Daaner\NovaPoshta\NovaPoshta;
6
use Daaner\NovaPoshta\Traits\Limit;
7
8
class ScanSheet extends NovaPoshta
9
{
10
    use Limit;
11
12
    protected $model = 'ScanSheet';
13
    protected $calledMethod;
14
    protected $methodProperties = null;
15
16
    /**
17
     * @see https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e/operations/556c6a2da0fe4f08e8f7ce2f
18
     *
19
     * @param string|array $ScanSheetRefs
20
     * @return array
21
     */
22
    public function deleteScanSheet($ScanSheetRefs)
23
    {
24
        $this->calledMethod = 'deleteScanSheet';
25
26
        if (is_array($ScanSheetRefs) === false) {
27
            $ScanSheetRefs = explode(', ', /** @scrutinizer ignore-type */ $ScanSheetRefs);
28
        }
29
30
        $this->methodProperties['ScanSheetRefs'] = array_values(/** @scrutinizer ignore-type */ $ScanSheetRefs);
31
32
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
33
    }
34
35
    /**
36
     * @see https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e/operations/556c4786a0fe4f0634657b65
37
     *
38
     * @param string|array $DocumentRefs
39
     * @return array
40
     */
41
    public function insertDocuments($DocumentRefs)
42
    {
43
        $this->calledMethod = 'insertDocuments';
44
45
        if (is_array($DocumentRefs) === false) {
46
            $DocumentRefs = explode(', ', /** @scrutinizer ignore-type */ $DocumentRefs);
47
        }
48
49
        $this->methodProperties['DocumentRefs'] = array_values(/** @scrutinizer ignore-type */ $DocumentRefs);
50
51
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
52
    }
53
54
    /**
55
     * @see https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e/operations/556c7734a0fe4f08e8f7ce31
56
     *
57
     * @return array
58
     */
59
    public function getScanSheetList()
60
    {
61
        $this->calledMethod = 'getScanSheetList';
62
63
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
64
    }
65
66
    /**
67
     * @see https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e/operations/556c72d7a0fe4f08e8f7ce30
68
     *
69
     * @param string $ref
70
     * @return array
71
     */
72
    public function getScanSheet($ref)
73
    {
74
        $this->calledMethod = 'getScanSheet';
75
76
        $this->methodProperties = [];
77
        $this->methodProperties['Ref'] = $ref;
78
79
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
80
    }
81
82
    /**
83
     * @see https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e/operations/556c6474a0fe4f08e8f7ce2e
84
     *
85
     * @param string|array $documents
86
     * @param string|null $ref
87
     * @return array
88
     */
89
    public function removeDocuments($documents, $ref = null)
90
    {
91
        $this->calledMethod = 'removeDocuments';
92
93
        $this->methodProperties = [];
94
        if ($ref) {
95
            $this->methodProperties['Ref'] = $ref;
96
        }
97
98
        if (is_array($documents) === false) {
99
            $documents = explode(', ', /** @scrutinizer ignore-type */ $documents);
100
        }
101
102
        $this->methodProperties['DocumentRefs'] = array_values(/** @scrutinizer ignore-type */ $documents);
103
104
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
105
    }
106
107
    /**
108
     * Не документировано.
109
     *
110
     * @param string $ref
111
     * @return array
112
     */
113
    public function getScanSheetDocuments($ref)
114
    {
115
        $this->methodProperties = [];
116
        $this->getPage();
117
        $this->addLimit();
118
119
        $this->calledMethod = 'getScanSheetDocuments';
120
        $this->methodProperties['Ref'] = $ref;
121
122
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
123
    }
124
125
    /**
126
     * Не документировано.
127
     *
128
     * @param string $ref
129
     * @param string|int $description
130
     * @return array
131
     */
132
    public function updateScanSheet($ref, $description)
133
    {
134
        $this->methodProperties = [];
135
136
        $this->calledMethod = 'updateScanSheet';
137
        $this->methodProperties['Ref'] = $ref;
138
        $this->methodProperties['Description'] = $description;
139
140
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
141
    }
142
}
143