PDFDocumentProperty   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 151
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 30
c 2
b 1
f 0
dl 0
loc 151
rs 10
wmc 17

11 Methods

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