Passed
Push — master ( a99763...fbfe14 )
by Andrey
03:27
created

PDFDocumentProperty::setThisIsScansheet()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Daaner\NovaPoshta\Traits;
4
5
trait PDFDocumentProperty
6
{
7
    protected $Copies;
8
    protected $PageFormat;
9
    protected $Position;
10
    protected $Type;
11
    protected $printForm;
12
13
    protected $isScansheet;
14
    protected $PrintOrientation;
15
16
17
    /**
18
     * Устанавливаем количество копий.
19
     * 1 - по умолчанию.
20
     *
21
     * @param  string  $Copies  Количество копий
22
     * @return $this
23
     */
24
    public function setCopies(string $Copies): self
25
    {
26
        $this->Copies = $Copies;
27
28
        return $this;
29
    }
30
31
    /**
32
     * @return void
33
     */
34
    public function getCopies(): void
35
    {
36
        $this->methodProperties['Copies'] = $this->Copies ?: 1;
37
    }
38
39
    /**
40
     * Устанавливаем формат страницы.
41
     * Варианты: A4, A5
42
     *
43
     * @param  string  $PageFormat  Формат страницы
44
     * @return $this
45
     */
46
    public function setPageFormat(string $PageFormat): self
47
    {
48
        $this->PageFormat = $PageFormat;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @return void
55
     */
56
    public function getPageFormat(): void
57
    {
58
        if ($this->PageFormat) {
59
            $this->methodProperties['PageFormat'] = $this->PageFormat;
60
        }
61
    }
62
63
    /**
64
     * Устанавливаем значение Position.
65
     *
66
     * @param  string  $Position  Указываем Position
67
     * @return $this
68
     */
69
    public function setPosition(string $Position): self
70
    {
71
        $this->Position = $Position;
72
73
        return $this;
74
    }
75
76
    /**
77
     * @return void
78
     */
79
    public function getPosition(): void
80
    {
81
        $this->methodProperties['Position'] = $this->Position ?: '1';
82
    }
83
84
    /**
85
     * Устанавливаем тип документа.
86
     * `pdf` - по умолчанию.
87
     * Варианты: pdf, pdf8
88
     *
89
     * @param  string  $Type  Указываем Type
90
     * @return $this
91
     */
92
    public function setType(string $Type): self
93
    {
94
        $this->Type = $Type;
95
96
        return $this;
97
    }
98
99
    /**
100
     * @return void
101
     */
102
    public function getType(): void
103
    {
104
        $this->methodProperties['Type'] = $this->Type ?: 'pdf';
105
    }
106
107
    /**
108
     * Устанавливаем макет документа.
109
     * По умолчанию - `Document_new`.
110
     *
111
     * Варианты:
112
     * `Document_new` - полная экспресс накладная
113
     *                - PageFormat: А4, A5
114
     *                - Type: pdf
115
     * `Marking_85x85` - наклейки на А4
116
     *                 - PageFormat: А4
117
     *                 - Type: pdf8
118
     * `Marking_100x100` - наклейки для принтера 100х100
119
     *                   - PageFormat: null
120
     *                   - Type: pdf
121
     *
122
     * @param  string  $printForm  Указываем макет
123
     * @return $this
124
     */
125
    public function setPrintForm(string $printForm): self
126
    {
127
        $this->printForm = $printForm;
128
129
        return $this;
130
    }
131
132
    /**
133
     * @return void
134
     */
135
    public function getPrintForm(): void
136
    {
137
        if (! $this->printForm) {
138
            $this->printForm = config('novaposhta.print_form');
139
        }
140
141
        $this->methodProperties['printForm'] = $this->printForm;
142
    }
143
144
145
    /**
146
     * Флаг, что данная распечатка является реестром.
147
     *
148
     * @param string|null $PrintOrientation Ориентация печати
149
     * @return $this
150
     */
151
    public function setThisIsScansheet(?string $PrintOrientation = null): self
152
    {
153
        $this->isScansheet = true;
154
        $this->printForm = 'ScanSheet';
155
        $this->PrintOrientation = $PrintOrientation ?: config('novaposhta.scan_sheet_orientation');
156
157
        return $this;
158
    }
159
160
161
}
162