GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#145)
by
unknown
05:01
created

PdfRequest::setZoom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the php-phantomjs.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace JonnyW\PhantomJs\Http;
11
12
/**
13
 * PHP PhantomJs
14
 *
15
 * @author Jon Wenmoth <[email protected]>
16
 */
17
class PdfRequest extends CaptureRequest
18
    implements PdfRequestInterface
19
{
20
    /**
21
     * Paper width
22
     *
23
     * @var int
24
     * @access protected
25
     */
26
    protected $paperWidth;
27
28
    /**
29
     * Paper height
30
     *
31
     * @var int
32
     * @access protected
33
     */
34
    protected $paperHeight;
35
36
    /**
37
     * Format
38
     *
39
     * @var string
40
     * @access protected
41
     */
42
    protected $format;
43
44
    /**
45
     * Orientation
46
     *
47
     * @var string
48
     * @access protected
49
     */
50
    protected $orientation;
51
52
    /**
53
     * Margin
54
     *
55
     * @var string|array
56
     * @access protected
57
     */
58
    protected $margin;
59
60
    /**
61
     * Repeating header
62
     *
63
     * @var array
64
     * @access protected
65
     */
66
    protected $header;
67
68
    /**
69
     * Repeating footer
70
     *
71
     * @var array
72
     * @access protected
73
     */
74
    protected $footer;
75
76
    /**
77
     * Zoom property specifies the scaling factor for the page.render and page.renderBase64 functions
78
     * The default is 1, i.e. 100% zoom
79
     *
80
     * @var float
81
     * @access protected
82
     */
83
    protected $zoom;
84
85 29
    /**
86
     * Internal constructor
87 29
     *
88
     * @access public
89 29
     * @param  string                                $url     (default: null)
90 29
     * @param  string                                $method  (default: RequestInterface::METHOD_GET)
91 29
     * @param  int                                   $timeout (default: 5000)
92 29
     * @return \JonnyW\PhantomJs\Http\CaptureRequest
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
93 29
     */
94 29
    public function __construct($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000)
95 29
    {
96
        parent::__construct($url, $method, $timeout);
97 29
98
        $this->paperWidth  = '';
0 ignored issues
show
Documentation Bug introduced by
The property $paperWidth was declared of type integer, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
99
        $this->paperHeight = '';
0 ignored issues
show
Documentation Bug introduced by
The property $paperHeight was declared of type integer, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
100
        $this->margin      = '1cm';
101
        $this->format      = 'A4';
102
        $this->orientation = 'portrait';
103
        $this->header      = array();
104
        $this->footer      = array();
105 8
        $this->zoom        = 1;
0 ignored issues
show
Documentation Bug introduced by
The property $zoom was declared of type double, but 1 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
106
    }
107 8
108 7
    /**
109
     * Get request type
110
     *
111 1
     * @access public
112
     * @return string
113
     */
114
    public function getType()
115
    {
116
        if (!$this->type) {
117
            return RequestInterface::REQUEST_TYPE_PDF;
118
        }
119
120
        return $this->type;
121
    }
122
123
    /**
124
     * Set paper width.
125
     *
126
     * @access public
127
     * @param  string $width
128
     * @return void
129
     */
130
    public function setPaperWidth($width)
131
    {
132 7
        $this->paperWidth = $width;
0 ignored issues
show
Documentation Bug introduced by
The property $paperWidth was declared of type integer, but $width is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
133
    }
134 7
135
    /**
136
     * Get paper width.
137
     *
138
     * @access public
139
     * @return string
140
     */
141
    public function getPaperWidth()
142
    {
143
        return $this->paperWidth;
144
    }
145
146
    /**
147
     * Set paper height.
148
     *
149
     * @access public
150
     * @param  string $height
151
     * @return void
152
     */
153
    public function setPaperHeight($height)
154
    {
155 7
        $this->paperHeight = $height;
0 ignored issues
show
Documentation Bug introduced by
The property $paperHeight was declared of type integer, but $height is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
156
    }
157 7
158
    /**
159
     * Get paper height.
160
     *
161
     * @access public
162
     * @return string
163
     */
164
    public function getPaperHeight()
165
    {
166
        return $this->paperHeight;
167
    }
168 3
169
    /**
170 3
     * Set paper size.
171 3
     *
172 3
     * @access public
173
     * @param  string $width
174
     * @param  string $height
175
     * @return void
176
     */
177
    public function setPaperSize($width, $height)
178
    {
179
        $this->paperWidth  = $width;
0 ignored issues
show
Documentation Bug introduced by
The property $paperWidth was declared of type integer, but $width is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
180
        $this->paperHeight = $height;
0 ignored issues
show
Documentation Bug introduced by
The property $paperHeight was declared of type integer, but $height is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
181 4
    }
182
183 4
    /**
184 4
     * Set format.
185
     *
186
     * @access public
187
     * @param  string $format
188
     * @return void
189
     */
190
    public function setFormat($format)
191
    {
192 6
        $this->format = $format;
193
    }
194 6
195
    /**
196
     * Get format.
197
     *
198
     * @access public
199
     * @return string
200
     */
201
    public function getFormat()
202
    {
203
        return $this->format;
204 3
    }
205
206 3
    /**
207 3
     * Set orientation.
208
     *
209
     * @access public
210
     * @param  string $orientation
211
     * @return void
212
     */
213
    public function setOrientation($orientation)
214
    {
215 6
        $this->orientation = $orientation;
216
    }
217 6
218
    /**
219
     * Get orientation.
220
     *
221
     * @access public
222
     * @return string
223
     */
224
    public function getOrientation()
225
    {
226
        return $this->orientation;
227 5
    }
228
229 5
    /**
230 5
     * Set margin.
231
     *
232
     * @access public
233
     * @param  string|array $margin
234
     * @return void
235
     */
236
    public function setMargin($margin)
237
    {
238 6
        $this->margin = $margin;
239
    }
240 6
241
    /**
242
     * Get margin.
243
     *
244
     * @access public
245
     * @return string|array
246
     */
247
    public function getMargin()
248
    {
249
        return $this->margin;
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->margin; of type string|array adds the type array to the return on line 249 which is incompatible with the return type declared by the interface JonnyW\PhantomJs\Http\Pd...estInterface::getMargin of type string.
Loading history...
250
    }
251 2
252
    /**
253 2
     * Set repeating header.
254 2
     *
255
     * @access public
256 2
     * @param  string $content
257 2
     * @param  string $height  (default: '1cm')
258
     * @return void
259
     */
260
    public function setRepeatingHeader($content, $height = '1cm')
261
    {
262
        $this->header = array(
263
            'content' => $content,
264
            'height'  => $height
265 6
        );
266
    }
267 6
268
    /**
269
     * Get repeating header.
270
     *
271
     * @access public
272
     * @return array
273
     */
274
    public function getRepeatingHeader()
275
    {
276
        return $this->header;
277
    }
278 2
279
    /**
280 2
     * Set repeating footer.
281 2
     *
282
     * @access public
283 2
     * @param  string $content
284 2
     * @param  string $height  (default: '1cm')
285
     * @return void
286
     */
287
    public function setRepeatingFooter($content, $height = '1cm')
288
    {
289
        $this->footer = array(
290
            'content' => $content,
291
            'height'  => $height
292 6
        );
293
    }
294 6
295
    /**
296
     * Get repeating footer.
297
     *
298
     * @access public
299
     * @return array
300
     */
301
    public function getRepeatingFooter()
302
    {
303
        return $this->footer;
304
    }
305
306
    /**
307
     * Set zoom
308
     *
309
     * @access public
310
     * @param  float $zoom  (default: 1)
311
     * @return void
312
     */
313
    public function setZoom($zoom)
314
    {
315
        $this->zoom = $zoom;
316
    }
317
318
    /**
319
     * Get zoom
320
     *
321
     * @access public
322
     * @return float
323
     */
324
    public function getZoom()
325
    {
326
        return $this->zoom;
327
    }
328
}
329