1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace TheCodingMachine \Gotenberg ;
4
6
7
+ use function count ;
8
+
5
9
abstract class ChromeRequest extends Request implements GotenbergRequestInterface
6
10
{
7
11
private const WAIT_DELAY = 'waitDelay ' ;
@@ -49,28 +53,29 @@ abstract class ChromeRequest extends Request implements GotenbergRequestInterfac
49
53
public function getFormValues (): array
50
54
{
51
55
$ values = parent ::getFormValues ();
52
- if (! is_null ( $ this ->waitDelay ) ) {
56
+ if ($ this ->waitDelay !== null ) {
53
57
$ values [self ::WAIT_DELAY ] = $ this ->waitDelay ;
54
58
}
55
- if (! is_null ( $ this ->paperWidth ) ) {
59
+ if ($ this ->paperWidth !== null ) {
56
60
$ values [self ::PAPER_WIDTH ] = $ this ->paperWidth ;
57
61
}
58
- if (! is_null ( $ this ->paperHeight ) ) {
62
+ if ($ this ->paperHeight !== null ) {
59
63
$ values [self ::PAPER_HEIGHT ] = $ this ->paperHeight ;
60
64
}
61
- if (! is_null ( $ this ->marginTop ) ) {
65
+ if ($ this ->marginTop !== null ) {
62
66
$ values [self ::MARGIN_TOP ] = $ this ->marginTop ;
63
67
}
64
- if (! is_null ( $ this ->marginBottom ) ) {
68
+ if ($ this ->marginBottom !== null ) {
65
69
$ values [self ::MARGIN_BOTTOM ] = $ this ->marginBottom ;
66
70
}
67
- if (! is_null ( $ this ->marginLeft ) ) {
71
+ if ($ this ->marginLeft !== null ) {
68
72
$ values [self ::MARGIN_LEFT ] = $ this ->marginLeft ;
69
73
}
70
- if (! is_null ( $ this ->marginRight ) ) {
74
+ if ($ this ->marginRight !== null ) {
71
75
$ values [self ::MARGIN_RIGHT ] = $ this ->marginRight ;
72
76
}
73
77
$ values [self ::LANDSCAPE ] = $ this ->landscape ;
78
+
74
79
return $ values ;
75
80
}
76
81
@@ -80,25 +85,24 @@ public function getFormValues(): array
80
85
public function getFormFiles (): array
81
86
{
82
87
$ files = [];
83
- if (!empty ($ this ->header )) {
88
+ if (! empty ($ this ->header )) {
84
89
$ files ['header.html ' ] = $ this ->header ;
85
90
}
86
- if (!empty ($ this ->footer )) {
91
+ if (! empty ($ this ->footer )) {
87
92
$ files ['footer.html ' ] = $ this ->footer ;
88
93
}
94
+
89
95
return $ files ;
90
96
}
91
97
92
- /**
93
- * @param float|null $waitDelay
94
- */
95
98
public function setWaitDelay (?float $ waitDelay ): void
96
99
{
97
100
$ this ->waitDelay = $ waitDelay ;
98
101
}
99
102
100
103
/**
101
104
* @param float[] $paperSize
105
+ *
102
106
* @throws RequestException
103
107
*/
104
108
public function setPaperSize (array $ paperSize ): void
@@ -112,6 +116,7 @@ public function setPaperSize(array $paperSize): void
112
116
113
117
/**
114
118
* @param float[] $margins
119
+ *
115
120
* @throws RequestException
116
121
*/
117
122
public function setMargins (array $ margins ): void
@@ -125,73 +130,46 @@ public function setMargins(array $margins): void
125
130
$ this ->marginRight = $ margins [3 ];
126
131
}
127
132
128
- /**
129
- * @param Document|null $header
130
- */
131
133
public function setHeader (?Document $ header ): void
132
134
{
133
135
$ this ->header = $ header ;
134
136
}
135
137
136
- /**
137
- * @param Document|null $footer
138
- */
139
138
public function setFooter (?Document $ footer ): void
140
139
{
141
140
$ this ->footer = $ footer ;
142
141
}
143
142
144
- /**
145
- * @param float|null $paperWidth
146
- */
147
143
public function setPaperWidth (?float $ paperWidth ): void
148
144
{
149
145
$ this ->paperWidth = $ paperWidth ;
150
146
}
151
147
152
- /**
153
- * @param float|null $paperHeight
154
- */
155
148
public function setPaperHeight (?float $ paperHeight ): void
156
149
{
157
150
$ this ->paperHeight = $ paperHeight ;
158
151
}
159
152
160
- /**
161
- * @param float|null $marginTop
162
- */
163
153
public function setMarginTop (?float $ marginTop ): void
164
154
{
165
155
$ this ->marginTop = $ marginTop ;
166
156
}
167
157
168
- /**
169
- * @param float|null $marginBottom
170
- */
171
158
public function setMarginBottom (?float $ marginBottom ): void
172
159
{
173
160
$ this ->marginBottom = $ marginBottom ;
174
161
}
175
162
176
- /**
177
- * @param float|null $marginLeft
178
- */
179
163
public function setMarginLeft (?float $ marginLeft ): void
180
164
{
181
165
$ this ->marginLeft = $ marginLeft ;
182
166
}
183
167
184
- /**
185
- * @param float|null $marginRight
186
- */
187
168
public function setMarginRight (?float $ marginRight ): void
188
169
{
189
170
$ this ->marginRight = $ marginRight ;
190
171
}
191
172
192
- /**
193
- * @param bool $landscape
194
- */
195
173
public function setLandscape (bool $ landscape ): void
196
174
{
197
175
$ this ->landscape = $ landscape ;
0 commit comments