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
Push — master ( ee6cec...dafb41 )
by Jonny
04:30
created

PdfRequest::setRepeatingFooter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
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
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 28
     * Repeating footer
70
     *
71 28
     * @var array
72
     * @access protected
73 28
     */
74 28
    protected $footer;
75 28
76 28
    /**
77 28
     * Internal constructor
78
     *
79 28
     * @access public
80
     * @param  string                                $url     (default: null)
81
     * @param  string                                $method  (default: RequestInterface::METHOD_GET)
82
     * @param  int                                   $timeout (default: 5000)
83
     * @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...
84
     */
85
    public function __construct($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000)
86
    {
87 6
        parent::__construct($url, $method, $timeout);
88
89 6
        $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...
90 5
        $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...
91
        $this->margin      = '1cm';
92
        $this->format      = 'A4';
93 1
        $this->orientation = 'portrait';
94
        $this->header      = array();
95
        $this->footer      = array();
96
97
    }
98
99
    /**
100
     * Get request type
101
     *
102
     * @access public
103
     * @return string
104
     */
105
    public function getType()
106
    {
107
        if (!$this->type) {
108
            return RequestInterface::REQUEST_TYPE_PDF;
109
        }
110
111
        return $this->type;
112
    }
113
114 5
    /**
115
     * Set paper width.
116 5
     *
117
     * @access public
118
     * @param  string $width
119
     * @return void
120
     */
121
    public function setPaperWidth($width)
122
    {
123
        $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...
124
    }
125
126
    /**
127
     * Get paper width.
128
     *
129
     * @access public
130
     * @return string
131
     */
132
    public function getPaperWidth()
133
    {
134
        return $this->paperWidth;
135
    }
136
137 5
    /**
138
     * Set paper height.
139 5
     *
140
     * @access public
141
     * @param  string $height
142
     * @return void
143
     */
144
    public function setPaperHeight($height)
145
    {
146
        $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...
147
    }
148
149
    /**
150 3
     * Get paper height.
151
     *
152 3
     * @access public
153 3
     * @return string
154 3
     */
155
    public function getPaperHeight()
156
    {
157
        return $this->paperHeight;
158
    }
159
160
    /**
161
     * Set paper size.
162
     *
163 2
     * @access public
164
     * @param  string $width
165 2
     * @param  string $height
166 2
     * @return void
167
     */
168
    public function setPaperSize($width, $height)
169
    {
170
        $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...
171
        $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...
172
    }
173
174 4
    /**
175
     * Set format.
176 4
     *
177
     * @access public
178
     * @param  string $format
179
     * @return void
180
     */
181
    public function setFormat($format)
182
    {
183
        $this->format = $format;
184
    }
185
186 1
    /**
187
     * Get format.
188 1
     *
189 1
     * @access public
190
     * @return string
191
     */
192
    public function getFormat()
193
    {
194
        return $this->format;
195
    }
196
197 4
    /**
198
     * Set orientation.
199 4
     *
200
     * @access public
201
     * @param  string $orientation
202
     * @return void
203
     */
204
    public function setOrientation($orientation)
205
    {
206
        $this->orientation = $orientation;
207
    }
208
209 3
    /**
210
     * Get orientation.
211 3
     *
212 3
     * @access public
213
     * @return string
214
     */
215
    public function getOrientation()
216
    {
217
        return $this->orientation;
218
    }
219
220 4
    /**
221
     * Set margin.
222 4
     *
223
     * @access public
224
     * @param  string $margin
225
     * @return void
226
     */
227
    public function setMargin($margin)
228
    {
229
        $this->margin = $margin;
230
    }
231
232
    /**
233
     * Get margin.
234
     *
235
     * @access public
236
     * @return string
237
     */
238
    public function getMargin()
239
    {
240
        return $this->margin;
241
    }
242
243
    /**
244
     * Set repeating header.
245
     *
246
     * @access public
247
     * @param  string $content
248
     * @param  string $height  (default: '1cm')
249
     * @return void
250
     */
251
    public function setRepeatingHeader($content, $height = '1cm')
252
    {
253
        $this->header = array(
254
            'content' => $content,
255
            'height'  => $height
256
        );
257
    }
258
259
    /**
260
     * Get repeating header.
261
     *
262
     * @access public
263
     * @return array
264
     */
265
    public function getRepeatingHeader()
266
    {
267
        return $this->header;
268
    }
269
270
    /**
271
     * Set repeating footer.
272
     *
273
     * @access public
274
     * @param  string $content
275
     * @param  string $height  (default: '1cm')
276
     * @return void
277
     */
278
    public function setRepeatingFooter($content, $height = '1cm')
279
    {
280
        $this->footer = array(
281
            'content' => $content,
282
            'height'  => $height
283
        );
284
    }
285
286
    /**
287
     * Get repeating footer.
288
     *
289
     * @access public
290
     * @return array
291
     */
292
    public function getRepeatingFooter()
293
    {
294
        return $this->footer;
295
    }
296
}
297