@@ -20,147 +20,185 @@ discard block |
||
20 | 20 | { |
21 | 21 | $params = $this->boolParams($params); |
22 | 22 | |
23 | - if (!empty($params['html']) && (!empty($params['url']) || !empty($params['file']))) |
|
24 | - throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!"); |
|
23 | + if (!empty($params['html']) && (!empty($params['url']) || !empty($params['file']))) { |
|
24 | + throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!"); |
|
25 | + } |
|
25 | 26 | |
26 | - if (!empty($params['url']) && !empty($params['file'])) |
|
27 | - throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!"); |
|
27 | + if (!empty($params['url']) && !empty($params['file'])) { |
|
28 | + throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!"); |
|
29 | + } |
|
28 | 30 | |
29 | 31 | if ((!empty($params['page_width']) && empty($params['page_height'])) |
30 | 32 | ||(empty($params['page_width']) && !empty($params['page_height']))) |
31 | 33 | { |
32 | 34 | throw new InvalidParameterException('Page width and page height must both be set or unset!'); |
33 | 35 | } |
34 | - if (!empty($params['filename']) && !is_string($params['filename'])) |
|
35 | - throw new InvalidParameterException('Filename must be a string.'); |
|
36 | + if (!empty($params['filename']) && !is_string($params['filename'])) { |
|
37 | + throw new InvalidParameterException('Filename must be a string.'); |
|
38 | + } |
|
36 | 39 | |
37 | - if (!empty($params['footer']) && !is_string($params['footer'])) |
|
38 | - throw new InvalidParameterException('Footer must be a string.'); |
|
40 | + if (!empty($params['footer']) && !is_string($params['footer'])) { |
|
41 | + throw new InvalidParameterException('Footer must be a string.'); |
|
42 | + } |
|
39 | 43 | |
40 | - if (!empty($params['header']) && !is_string($params['header'])) |
|
41 | - throw new InvalidParameterException('Header must be a string.'); |
|
44 | + if (!empty($params['header']) && !is_string($params['header'])) { |
|
45 | + throw new InvalidParameterException('Header must be a string.'); |
|
46 | + } |
|
42 | 47 | |
43 | - if (!empty($params['header_spacing']) && !is_int($params['header_spacing'])) |
|
44 | - throw new InvalidParameterException('Header spacing parameter must be an integer.'); |
|
48 | + if (!empty($params['header_spacing']) && !is_int($params['header_spacing'])) { |
|
49 | + throw new InvalidParameterException('Header spacing parameter must be an integer.'); |
|
50 | + } |
|
45 | 51 | |
46 | - if (!empty($params['footer_spacing']) && !is_int($params['footer_spacing'])) |
|
47 | - throw new InvalidParameterException('Footer spacing parameter must be an integer.'); |
|
52 | + if (!empty($params['footer_spacing']) && !is_int($params['footer_spacing'])) { |
|
53 | + throw new InvalidParameterException('Footer spacing parameter must be an integer.'); |
|
54 | + } |
|
48 | 55 | |
49 | - if (!empty($params['page_size']) && !is_string($params['page_size'])) |
|
50 | - throw new InvalidParameterException('Page size must be a string of some standard page size.'); |
|
56 | + if (!empty($params['page_size']) && !is_string($params['page_size'])) { |
|
57 | + throw new InvalidParameterException('Page size must be a string of some standard page size.'); |
|
58 | + } |
|
51 | 59 | |
52 | - if (!empty($params['dpi']) && (!is_int($params['dpi']) || $params['dpi']<75)) |
|
53 | - throw new InvalidParameterException('DPI must be an integer larger than 75.'); |
|
60 | + if (!empty($params['dpi']) && (!is_int($params['dpi']) || $params['dpi']<75)) { |
|
61 | + throw new InvalidParameterException('DPI must be an integer larger than 75.'); |
|
62 | + } |
|
54 | 63 | |
55 | - if (!empty($params['image_dpi']) && !is_int($params['image_dpi'])) |
|
56 | - throw new InvalidParameterException('Image DPI must be an integer.'); |
|
64 | + if (!empty($params['image_dpi']) && !is_int($params['image_dpi'])) { |
|
65 | + throw new InvalidParameterException('Image DPI must be an integer.'); |
|
66 | + } |
|
57 | 67 | |
58 | 68 | if (!empty($params['lowquality']) && (!is_int($params['lowquality']) || !in_array($params['lowquality'], array( |
59 | - 0, 1 ) ))) |
|
60 | - throw new InvalidParameterException( |
|
69 | + 0, 1 ) ))) { |
|
70 | + throw new InvalidParameterException( |
|
61 | 71 | 'Lowquality must be either 0 or 1 (alternative: use bool values'); |
72 | + } |
|
62 | 73 | |
63 | 74 | if (!empty($params['orientation']) && (!is_string($params['orientation']) || !in_array($params['orientation'], |
64 | - array("landscape", "portrait")))) |
|
65 | - throw new InvalidParameterException('Orientation must be set to either "landscape" or "portrait"'); |
|
75 | + array("landscape", "portrait")))) { |
|
76 | + throw new InvalidParameterException('Orientation must be set to either "landscape" or "portrait"'); |
|
77 | + } |
|
66 | 78 | |
67 | - if (!empty($params['margin_top']) && !is_int($params['margin_top'])) |
|
68 | - throw new InvalidParameterException('Margin top must be an integer.'); |
|
79 | + if (!empty($params['margin_top']) && !is_int($params['margin_top'])) { |
|
80 | + throw new InvalidParameterException('Margin top must be an integer.'); |
|
81 | + } |
|
69 | 82 | |
70 | - if (!empty($params['margin_bottom']) && !is_int($params['margin_bottom'])) |
|
71 | - throw new InvalidParameterException('Margin top must be an integer.'); |
|
83 | + if (!empty($params['margin_bottom']) && !is_int($params['margin_bottom'])) { |
|
84 | + throw new InvalidParameterException('Margin top must be an integer.'); |
|
85 | + } |
|
72 | 86 | |
73 | - if (!empty($params['margin_left']) && !is_int($params['margin_left'])) |
|
74 | - throw new InvalidParameterException('Margin top must be an integer.'); |
|
87 | + if (!empty($params['margin_left']) && !is_int($params['margin_left'])) { |
|
88 | + throw new InvalidParameterException('Margin top must be an integer.'); |
|
89 | + } |
|
75 | 90 | |
76 | - if (!empty($params['margin_right']) && !is_int($params['margin_right'])) |
|
77 | - throw new InvalidParameterException('Margin top must be an integer.'); |
|
91 | + if (!empty($params['margin_right']) && !is_int($params['margin_right'])) { |
|
92 | + throw new InvalidParameterException('Margin top must be an integer.'); |
|
93 | + } |
|
78 | 94 | |
79 | 95 | if (!empty($params['background']) && (!is_int($params['background']) || !in_array($params['background'], array( |
80 | - 0, 1 ) ))) |
|
81 | - throw new InvalidParameterException( |
|
96 | + 0, 1 ) ))) { |
|
97 | + throw new InvalidParameterException( |
|
82 | 98 | 'Background must be either 0 or 1 (alternative: use bool values'); |
99 | + } |
|
83 | 100 | |
84 | 101 | if (!empty($params['images']) && (!is_int($params['images']) || !in_array($params['images'], array( |
85 | - 0, 1 ) ))) |
|
86 | - throw new InvalidParameterException( |
|
102 | + 0, 1 ) ))) { |
|
103 | + throw new InvalidParameterException( |
|
87 | 104 | 'Images must be either 0 or 1 (alternative: use bool values'); |
105 | + } |
|
88 | 106 | |
89 | - if (!empty($params['page_width']) && !is_int($params['page_width'])) |
|
90 | - throw new InvalidParameterException('Page width must be an integer.'); |
|
107 | + if (!empty($params['page_width']) && !is_int($params['page_width'])) { |
|
108 | + throw new InvalidParameterException('Page width must be an integer.'); |
|
109 | + } |
|
91 | 110 | |
92 | - if (!empty($params['page_height']) && !is_int($params['page_height'])) |
|
93 | - throw new InvalidParameterException('Page height must be an integer.'); |
|
111 | + if (!empty($params['page_height']) && !is_int($params['page_height'])) { |
|
112 | + throw new InvalidParameterException('Page height must be an integer.'); |
|
113 | + } |
|
94 | 114 | |
95 | 115 | if (!empty($params['disposition']) && (!is_string($params['disposition']) || !in_array($params['disposition'], |
96 | - array("attachment", "inline")))) |
|
97 | - throw new InvalidParameterException('Disposition can only be "attachment or "inline"'); |
|
116 | + array("attachment", "inline")))) { |
|
117 | + throw new InvalidParameterException('Disposition can only be "attachment or "inline"'); |
|
118 | + } |
|
98 | 119 | |
99 | - if (!empty($params['group']) && !is_string($params['group'])) |
|
100 | - throw new InvalidParameterException('Group must be a string.'); |
|
120 | + if (!empty($params['group']) && !is_string($params['group'])) { |
|
121 | + throw new InvalidParameterException('Group must be a string.'); |
|
122 | + } |
|
101 | 123 | |
102 | 124 | if (!empty($params['engine_version']) && (!is_int($params['engine_version']) || !in_array($params['engine_version'], |
103 | - array( 11, 12 ) ))) |
|
104 | - throw new InvalidParameterException( |
|
125 | + array( 11, 12 ) ))) { |
|
126 | + throw new InvalidParameterException( |
|
105 | 127 | 'Engine version can be integer 11 or 12'); |
128 | + } |
|
106 | 129 | |
107 | - if (!empty($params['title']) && !is_string($params['title'])) |
|
108 | - throw new InvalidParameterException('Title must be a string.'); |
|
130 | + if (!empty($params['title']) && !is_string($params['title'])) { |
|
131 | + throw new InvalidParameterException('Title must be a string.'); |
|
132 | + } |
|
109 | 133 | |
110 | 134 | if (!empty($params['outline']) && (!is_int($params['outline']) || !in_array($params['outline'], array( |
111 | - 0, 1 ) ))) |
|
112 | - throw new InvalidParameterException( |
|
135 | + 0, 1 ) ))) { |
|
136 | + throw new InvalidParameterException( |
|
113 | 137 | 'Outline must be either 0 or 1 (alternative: use bool values'); |
138 | + } |
|
114 | 139 | |
115 | - if (!empty($params['outline_depth']) && !is_int($params['outline_depth'])) |
|
116 | - throw new InvalidParameterException('Outline depth must be an integer.'); |
|
140 | + if (!empty($params['outline_depth']) && !is_int($params['outline_depth'])) { |
|
141 | + throw new InvalidParameterException('Outline depth must be an integer.'); |
|
142 | + } |
|
117 | 143 | |
118 | - if (!empty($params['encoding']) && !is_string($params['encoding'])) |
|
119 | - throw new InvalidParameterException('Encoding must be a string.'); |
|
144 | + if (!empty($params['encoding']) && !is_string($params['encoding'])) { |
|
145 | + throw new InvalidParameterException('Encoding must be a string.'); |
|
146 | + } |
|
120 | 147 | |
121 | 148 | if (!empty($params['javascript']) && (!is_int($params['javascript']) || !in_array($params['javascript'], array( |
122 | - 0, 1 ) ))) |
|
123 | - throw new InvalidParameterException( |
|
149 | + 0, 1 ) ))) { |
|
150 | + throw new InvalidParameterException( |
|
124 | 151 | 'Javascript must be either 0 or 1 (alternative: use bool values'); |
152 | + } |
|
125 | 153 | |
126 | 154 | if (!empty($params['javascript_delay']) && |
127 | - (!is_int($params['javascript_delay']) || $params['javascript_delay']<1 || $params['javascript_delay']>800)) |
|
128 | - throw new InvalidParameterException('Javascript delay must be an integer larger than 1, but smaller than 800.'); |
|
155 | + (!is_int($params['javascript_delay']) || $params['javascript_delay']<1 || $params['javascript_delay']>800)) { |
|
156 | + throw new InvalidParameterException('Javascript delay must be an integer larger than 1, but smaller than 800.'); |
|
157 | + } |
|
129 | 158 | |
130 | 159 | if (!empty($params['internal_links']) && |
131 | - (!is_int($params['internal_links']) || !in_array($params['internal_links'], array( 0, 1 ) ))) |
|
132 | - throw new InvalidParameterException( |
|
160 | + (!is_int($params['internal_links']) || !in_array($params['internal_links'], array( 0, 1 ) ))) { |
|
161 | + throw new InvalidParameterException( |
|
133 | 162 | 'Internal links must be either 0 or 1 (alternative: use bool values'); |
163 | + } |
|
134 | 164 | |
135 | 165 | if (!empty($params['external_links']) && |
136 | - (!is_int($params['external_links']) || !in_array($params['external_links'], array( 0, 1 ) ))) |
|
137 | - throw new InvalidParameterException( |
|
166 | + (!is_int($params['external_links']) || !in_array($params['external_links'], array( 0, 1 ) ))) { |
|
167 | + throw new InvalidParameterException( |
|
138 | 168 | 'External links must be either 0 or 1 (alternative: use bool values'); |
169 | + } |
|
139 | 170 | |
140 | - if (!empty($params['page_offset']) && !is_int($params['page_offset'])) |
|
141 | - throw new InvalidParameterException('Page offset must be an integer.'); |
|
171 | + if (!empty($params['page_offset']) && !is_int($params['page_offset'])) { |
|
172 | + throw new InvalidParameterException('Page offset must be an integer.'); |
|
173 | + } |
|
142 | 174 | |
143 | - if (!empty($params['username']) && !is_string($params['username'])) |
|
144 | - throw new InvalidParameterException('Username must be a string.'); |
|
175 | + if (!empty($params['username']) && !is_string($params['username'])) { |
|
176 | + throw new InvalidParameterException('Username must be a string.'); |
|
177 | + } |
|
145 | 178 | |
146 | - if (!empty($params['password']) && !is_string($params['password'])) |
|
147 | - throw new InvalidParameterException('Password must be a string.'); |
|
179 | + if (!empty($params['password']) && !is_string($params['password'])) { |
|
180 | + throw new InvalidParameterException('Password must be a string.'); |
|
181 | + } |
|
148 | 182 | |
149 | 183 | if (!empty($params['use_print_media']) && |
150 | 184 | (!is_int($params['use_print_media']) || !in_array($params['use_print_media'], array( |
151 | - 0, 1 ) ))) |
|
152 | - throw new InvalidParameterException( |
|
185 | + 0, 1 ) ))) { |
|
186 | + throw new InvalidParameterException( |
|
153 | 187 | 'Use print media must be either 0 or 1 (alternative: use bool values'); |
188 | + } |
|
154 | 189 | |
155 | - if (!empty($params['zoom']) && !is_numeric($params['zoom'])) |
|
156 | - throw new InvalidParameterException('Zoom must be an integer.'); |
|
190 | + if (!empty($params['zoom']) && !is_numeric($params['zoom'])) { |
|
191 | + throw new InvalidParameterException('Zoom must be an integer.'); |
|
192 | + } |
|
157 | 193 | |
158 | 194 | if (!empty($params['viewport_size']) && |
159 | - (!is_string($params['viewport_size'] || preg_match("^\\d+x\\d+$", $params['viewport_size'])))) |
|
160 | - throw new InvalidParameterException('Viewport must be a string of a following format: [width]x[height].'); |
|
195 | + (!is_string($params['viewport_size'] || preg_match("^\\d+x\\d+$", $params['viewport_size'])))) { |
|
196 | + throw new InvalidParameterException('Viewport must be a string of a following format: [width]x[height].'); |
|
197 | + } |
|
161 | 198 | |
162 | - if (!empty($params['id']) && !is_string($params['id'])) |
|
163 | - throw new InvalidParameterException('ID must be a string.'); |
|
199 | + if (!empty($params['id']) && !is_string($params['id'])) { |
|
200 | + throw new InvalidParameterException('ID must be a string.'); |
|
201 | + } |
|
164 | 202 | |
165 | 203 | /*if (!empty($params['file'])) |
166 | 204 | $this->validateFile($params['file']);*/ |
@@ -180,16 +218,18 @@ discard block |
||
180 | 218 | { |
181 | 219 | $filePath = substr($file, 1); |
182 | 220 | |
183 | - if (!is_file($filePath)) |
|
184 | - throw new FileNotFoundException("File ".$filePath." was not found"); |
|
221 | + if (!is_file($filePath)) { |
|
222 | + throw new FileNotFoundException("File ".$filePath." was not found"); |
|
223 | + } |
|
185 | 224 | |
186 | 225 | $path_parts = pathinfo($filePath); |
187 | 226 | |
188 | 227 | if( !in_array($path_parts['extension'], array( |
189 | 228 | "js", "css", "png", "jpg", "jpeg", "gif", "ttf", "otf", "woff" |
190 | - ))) |
|
191 | - throw new WrongFileExtensionException("Wrong file format\n |
|
229 | + ))) { |
|
230 | + throw new WrongFileExtensionException("Wrong file format\n |
|
192 | 231 | Supported formats: js, css, png, jpg, jpeg, gif, ttf, otf, woff"); |
232 | + } |
|
193 | 233 | } |
194 | 234 | |
195 | 235 | /** |
@@ -204,16 +244,18 @@ discard block |
||
204 | 244 | { |
205 | 245 | $filePath = substr($file, 1); |
206 | 246 | |
207 | - if (!is_file($filePath)) |
|
208 | - throw new FileNotFoundException("File ".$filePath." was not found"); |
|
247 | + if (!is_file($filePath)) { |
|
248 | + throw new FileNotFoundException("File ".$filePath." was not found"); |
|
249 | + } |
|
209 | 250 | |
210 | 251 | $path_parts = pathinfo($filePath); |
211 | 252 | |
212 | 253 | if( !in_array($path_parts['extension'], array( |
213 | 254 | "html", "htm", "zip", "tar.gz", "tgz", "tar.bz2" |
214 | - ))) |
|
215 | - throw new WrongFileExtensionException("Wrong file format\n |
|
255 | + ))) { |
|
256 | + throw new WrongFileExtensionException("Wrong file format\n |
|
216 | 257 | Supported formats: html, htm, zip, tar.gz, tgz, tar.bz2"); |
258 | + } |
|
217 | 259 | } |
218 | 260 | |
219 | 261 | /** |
@@ -224,29 +266,37 @@ discard block |
||
224 | 266 | */ |
225 | 267 | private function boolParams($params) |
226 | 268 | { |
227 | - if (isset($params['lowquality']) && $params['lowquality']===false) |
|
228 | - $params['lowquality'] = (int) $params['lowquality']; |
|
269 | + if (isset($params['lowquality']) && $params['lowquality']===false) { |
|
270 | + $params['lowquality'] = (int) $params['lowquality']; |
|
271 | + } |
|
229 | 272 | |
230 | - if (isset($params['images']) && $params['images']===false) |
|
231 | - $params['images'] = (int) $params['images']; |
|
273 | + if (isset($params['images']) && $params['images']===false) { |
|
274 | + $params['images'] = (int) $params['images']; |
|
275 | + } |
|
232 | 276 | |
233 | - if (isset($params['outline']) && $params['outline']===false) |
|
234 | - $params['outline'] = (int) $params['outline']; |
|
277 | + if (isset($params['outline']) && $params['outline']===false) { |
|
278 | + $params['outline'] = (int) $params['outline']; |
|
279 | + } |
|
235 | 280 | |
236 | - if (isset($params['javascript']) && $params['javascript']===false) |
|
237 | - $params['javascript'] = (int) $params['javascript']; |
|
281 | + if (isset($params['javascript']) && $params['javascript']===false) { |
|
282 | + $params['javascript'] = (int) $params['javascript']; |
|
283 | + } |
|
238 | 284 | |
239 | - if (isset($params['internal_links']) && $params['internal_links']===false) |
|
240 | - $params['internal_links'] = (int) $params['internal_links']; |
|
285 | + if (isset($params['internal_links']) && $params['internal_links']===false) { |
|
286 | + $params['internal_links'] = (int) $params['internal_links']; |
|
287 | + } |
|
241 | 288 | |
242 | - if (isset($params['external_links']) && $params['external_links']===false) |
|
243 | - $params['external_links'] = (int) $params['external_links']; |
|
289 | + if (isset($params['external_links']) && $params['external_links']===false) { |
|
290 | + $params['external_links'] = (int) $params['external_links']; |
|
291 | + } |
|
244 | 292 | |
245 | - if (isset($params['use_print_media']) && $params['use_print_media']===false) |
|
246 | - $params['use_print_media'] = (int) $params['use_print_media']; |
|
293 | + if (isset($params['use_print_media']) && $params['use_print_media']===false) { |
|
294 | + $params['use_print_media'] = (int) $params['use_print_media']; |
|
295 | + } |
|
247 | 296 | |
248 | - if (isset($params['background']) && $params['background']===false) |
|
249 | - $params['background'] = (int) $params['background']; |
|
297 | + if (isset($params['background']) && $params['background']===false) { |
|
298 | + $params['background'] = (int) $params['background']; |
|
299 | + } |
|
250 | 300 | |
251 | 301 | return $params; |
252 | 302 | } |
@@ -132,20 +132,18 @@ |
||
132 | 132 | { |
133 | 133 | if($method=='POST') |
134 | 134 | { |
135 | - if (!empty($params['file'])) |
|
136 | - $ch = $this->initiateUpload($url, $params); |
|
137 | - else |
|
138 | - $ch = $this->initiatePost($url, $params); |
|
139 | - } |
|
140 | - else if($method=='GET') |
|
135 | + if (!empty($params['file'])) { |
|
136 | + $ch = $this->initiateUpload($url, $params); |
|
137 | + } else { |
|
138 | + $ch = $this->initiatePost($url, $params); |
|
139 | + } |
|
140 | + } else if($method=='GET') |
|
141 | 141 | { |
142 | 142 | $ch = $this->initiateGet($url, $params); |
143 | - } |
|
144 | - else if($method=='DELETE') |
|
143 | + } else if($method=='DELETE') |
|
145 | 144 | { |
146 | 145 | $ch = $this->initiateDelete($url, $params); |
147 | - } |
|
148 | - else{ |
|
146 | + } else{ |
|
149 | 147 | throw new \Exception("Method ".$method." not supported!"); |
150 | 148 | } |
151 | 149 |
@@ -54,14 +54,11 @@ discard block |
||
54 | 54 | try{ |
55 | 55 | if (!empty($params['html'])){ |
56 | 56 | $commandName = 'GenerateFromHTML'; |
57 | - } |
|
58 | - else if (!empty($params['url'])){ |
|
57 | + } else if (!empty($params['url'])){ |
|
59 | 58 | $commandName = 'GenerateFromURL'; |
60 | - } |
|
61 | - else if (!empty($params['file'])&& $url=='pdf'){ |
|
59 | + } else if (!empty($params['file'])&& $url=='pdf'){ |
|
62 | 60 | $commandName = 'GenerateFromFile'; |
63 | - } |
|
64 | - else { |
|
61 | + } else { |
|
65 | 62 | $operations = $this->getDescription()->getOperations(); |
66 | 63 | foreach ($operations as $operation) |
67 | 64 | { |
@@ -80,7 +77,7 @@ discard block |
||
80 | 77 | } |
81 | 78 | return $ret->getBody(true); |
82 | 79 | |
83 | - }catch(ClientErrorResponseException $exception){ |
|
80 | + } catch(ClientErrorResponseException $exception){ |
|
84 | 81 | throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode()); |
85 | 82 | } |
86 | 83 | } |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function generateFromURL($params) |
41 | 41 | { |
42 | - if(empty($params['url'])) |
|
43 | - throw new \Exception('Parameter \'url\' must be set' ); |
|
42 | + if(empty($params['url'])) { |
|
43 | + throw new \Exception('Parameter \'url\' must be set' ); |
|
44 | + } |
|
44 | 45 | |
45 | 46 | $params = $this->validator->validate($params); |
46 | 47 | |
@@ -61,8 +62,9 @@ discard block |
||
61 | 62 | */ |
62 | 63 | public function generateFromHTML($params) |
63 | 64 | { |
64 | - if(empty($params['html'])) |
|
65 | - throw new \Exception('Parameter \'html\' must be set' ); |
|
65 | + if(empty($params['html'])) { |
|
66 | + throw new \Exception('Parameter \'html\' must be set' ); |
|
67 | + } |
|
66 | 68 | |
67 | 69 | $params = $this->validator->validate($params); |
68 | 70 | |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | */ |
83 | 85 | public function generateFromFile($params) |
84 | 86 | { |
85 | - if(empty($params['file'])) |
|
86 | - throw new \Exception('Parameter \'file\' must be set' ); |
|
87 | + if(empty($params['file'])) { |
|
88 | + throw new \Exception('Parameter \'file\' must be set' ); |
|
89 | + } |
|
87 | 90 | |
88 | 91 | $params['file'] = '@'.$params['file']; |
89 | 92 | $params = $this->validator->validate($params); |