1 | <?php |
||
19 | class CaptureRequest extends AbstractRequest |
||
20 | implements CaptureRequestInterface |
||
21 | { |
||
22 | /** |
||
23 | * Request type. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $type; |
||
28 | |||
29 | /** |
||
30 | * File to save output. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $outputFile; |
||
35 | |||
36 | /** |
||
37 | * Rect top. |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | protected $rectTop; |
||
42 | |||
43 | /** |
||
44 | * Rect left. |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $rectLeft; |
||
49 | |||
50 | /** |
||
51 | * Rect width. |
||
52 | * |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $rectWidth; |
||
56 | |||
57 | /** |
||
58 | * Rect height. |
||
59 | * |
||
60 | * @var int |
||
61 | */ |
||
62 | protected $rectHeight; |
||
63 | |||
64 | /** |
||
65 | * Capture Format. |
||
66 | * |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $format; |
||
70 | |||
71 | /** |
||
72 | * Capture Quality. |
||
73 | * |
||
74 | * @var int |
||
75 | */ |
||
76 | protected $quality; |
||
77 | |||
78 | /** |
||
79 | * Internal constructor. |
||
80 | * |
||
81 | * @param string $url (default: null) |
||
82 | * @param string $method (default: RequestInterface::METHOD_GET) |
||
83 | * @param int $timeout (default: 5000) |
||
84 | * |
||
85 | * @return \JonnyW\PhantomJs\Http\CaptureRequest |
||
|
|||
86 | */ |
||
87 | 66 | public function __construct($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000) |
|
98 | |||
99 | /** |
||
100 | * Get request type. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 9 | public function getType() |
|
112 | |||
113 | /** |
||
114 | * Set request type. |
||
115 | * |
||
116 | * @param string $type |
||
117 | * |
||
118 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
119 | */ |
||
120 | 2 | public function setType($type) |
|
126 | |||
127 | /** |
||
128 | * Set viewport size. |
||
129 | * |
||
130 | * @param int $width |
||
131 | * @param int $height |
||
132 | * @param int $top (default: 0) |
||
133 | * @param int $left (default: 0) |
||
134 | * |
||
135 | * @return \JonnyW\PhantomJs\Http\AbstractRequest |
||
136 | */ |
||
137 | 5 | public function setCaptureDimensions($width, $height, $top = 0, $left = 0) |
|
146 | |||
147 | /** |
||
148 | * Get rect top. |
||
149 | * |
||
150 | * @return int |
||
151 | */ |
||
152 | 14 | public function getRectTop() |
|
156 | |||
157 | /** |
||
158 | * Get rect left. |
||
159 | * |
||
160 | * @return int |
||
161 | */ |
||
162 | 14 | public function getRectLeft() |
|
166 | |||
167 | /** |
||
168 | * Get rect width. |
||
169 | * |
||
170 | * @return int |
||
171 | */ |
||
172 | 14 | public function getRectWidth() |
|
176 | |||
177 | /** |
||
178 | * Get rect height. |
||
179 | * |
||
180 | * @return int |
||
181 | */ |
||
182 | 14 | public function getRectHeight() |
|
186 | |||
187 | /** |
||
188 | * Set file to save output. |
||
189 | * |
||
190 | * @param string $file |
||
191 | * |
||
192 | * @throws \JonnyW\PhantomJs\Exception\NotWritableException |
||
193 | * |
||
194 | * @return \JonnyW\PhantomJs\Http\CaptureRequest |
||
195 | */ |
||
196 | 12 | public function setOutputFile($file) |
|
206 | |||
207 | /** |
||
208 | * Get output file. |
||
209 | * |
||
210 | * @return string |
||
211 | */ |
||
212 | 15 | public function getOutputFile() |
|
216 | |||
217 | /** |
||
218 | * Get image format of the capture. |
||
219 | * |
||
220 | * @return string |
||
221 | */ |
||
222 | 7 | public function getFormat() |
|
226 | |||
227 | /** |
||
228 | * Set image format of capture. |
||
229 | * options: pdf, png, jpeg, bmp, ppm, gif. |
||
230 | * |
||
231 | * @param string $format |
||
232 | */ |
||
233 | public function setFormat($format) |
||
239 | |||
240 | /** |
||
241 | * Get quality of capture. |
||
242 | * |
||
243 | * @return string |
||
244 | */ |
||
245 | 7 | public function getQuality() |
|
249 | |||
250 | /** |
||
251 | * Set quality of the capture. |
||
252 | * example: 0 - 100. |
||
253 | * |
||
254 | * @param int $format |
||
255 | */ |
||
256 | public function setQuality($quality) |
||
262 | } |
||
263 |
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.