Skip to content

Commit 5fc21fe

Browse files
committed
Deprecate convert methods in favour of their camel case variants
1 parent f473bee commit 5fc21fe

File tree

1 file changed

+200
-50
lines changed

1 file changed

+200
-50
lines changed

src/Prince.php

Lines changed: 200 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,9 @@ public function __construct($exePath)
260260
* @param array $dats An optional array in which to return data messages.
261261
* @return bool `true` if a PDF file was generated successfully.
262262
*/
263-
public function convert_file($inputPath, &$msgs = array(), &$dats = array())
263+
public function convertFile($inputPath, &$msgs = array(), &$dats = array())
264264
{
265-
$pathAndArgs = $this->getCommandLine();
266-
$pathAndArgs .= '--structured-log=normal ';
267-
$pathAndArgs .= '"' . $inputPath . '"';
268-
269-
return $this->fileToFile($pathAndArgs, $msgs, $dats);
265+
return $this->convert_file($inputPath, $msgs, $dats);
270266
}
271267

272268
/**
@@ -279,17 +275,13 @@ public function convert_file($inputPath, &$msgs = array(), &$dats = array())
279275
* @param array $dats An optional array in which to return data messages.
280276
* @return bool `true` if a PDF file was generated successfully.
281277
*/
282-
public function convert_file_to_file(
278+
public function convertFileToFile(
283279
$inputPath,
284280
$pdfPath,
285281
&$msgs = array(),
286282
&$dats = array()
287283
) {
288-
$pathAndArgs = $this->getCommandLine();
289-
$pathAndArgs .= '--structured-log=normal ';
290-
$pathAndArgs .= '"' . $inputPath . '" -o "' . $pdfPath . '"';
291-
292-
return $this->fileToFile($pathAndArgs, $msgs, $dats);
284+
return $this->convert_file_to_file($inputPath, $pdfPath, $msgs, $dats);
293285
}
294286

295287
/**
@@ -302,22 +294,13 @@ public function convert_file_to_file(
302294
* @param array $dats An optional array in which to return data messages.
303295
* @return bool `true` if a PDF file was generated successfully.
304296
*/
305-
public function convert_multiple_files(
297+
public function convertMultipleFiles(
306298
$inputPaths,
307299
$pdfPath,
308300
&$msgs = array(),
309301
&$dats = array()
310302
) {
311-
$pathAndArgs = $this->getCommandLine();
312-
$pathAndArgs .= '--structured-log=normal ';
313-
314-
foreach ($inputPaths as $inputPath) {
315-
$pathAndArgs .= '"' . $inputPath . '" ';
316-
}
317-
318-
$pathAndArgs .= '-o "' . $pdfPath . '"';
319-
320-
return $this->fileToFile($pathAndArgs, $msgs, $dats);
303+
return $this->convert_multiple_files($inputPaths, $pdfPath, $msgs, $dats);
321304
}
322305

323306
/**
@@ -330,21 +313,12 @@ public function convert_multiple_files(
330313
* @param array $dats An optional array in which to return data messages.
331314
* @return bool `true` if a PDF file was generated successfully.
332315
*/
333-
public function convert_multiple_files_to_passthru(
316+
public function convertMultipleFilesToPassthru(
334317
$inputPaths,
335318
&$msgs = array(),
336319
&$dats = array()
337320
) {
338-
$pathAndArgs = $this->getCommandLine();
339-
$pathAndArgs .= '--structured-log=buffered ';
340-
341-
foreach ($inputPaths as $inputPath) {
342-
$pathAndArgs .= '"' . $inputPath . '" ';
343-
}
344-
345-
$pathAndArgs .= '-o -';
346-
347-
return $this->fileToPassthru($pathAndArgs, $msgs, $dats);
321+
return $this->convert_multiple_files_to_passthru($inputPaths, $msgs, $dats);
348322
}
349323

350324
/**
@@ -357,15 +331,12 @@ public function convert_multiple_files_to_passthru(
357331
* @param array $dats An optional array in which to return data messages.
358332
* @return bool `true` if a PDF file was generated successfully.
359333
*/
360-
public function convert_file_to_passthru(
334+
public function convertFileToPassthru(
361335
$inputPath,
362336
&$msgs = array(),
363337
&$dats = array()
364338
) {
365-
$pathAndArgs = $this->getCommandLine();
366-
$pathAndArgs .= '--structured-log=buffered "' . $inputPath . '" -o -';
367-
368-
return $this->fileToPassthru($pathAndArgs, $msgs, $dats);
339+
return $this->convert_file_to_passthru($inputPath, $msgs, $dats);
369340
}
370341

371342
/**
@@ -378,15 +349,12 @@ public function convert_file_to_passthru(
378349
* @param array $dats An optional array in which to return data messages.
379350
* @return bool `true` if a PDF file was generated successfully.
380351
*/
381-
public function convert_string_to_passthru(
352+
public function convertStringToPassthru(
382353
$inputString,
383354
&$msgs = array(),
384355
&$dats = array()
385356
) {
386-
$pathAndArgs = $this->getCommandLine();
387-
$pathAndArgs .= '--structured-log=buffered -';
388-
389-
return $this->stringToPassthru($pathAndArgs, $inputString, $msgs, $dats);
357+
return $this->convert_string_to_passthru($inputString, $msgs, $dats);
390358
}
391359

392360
/**
@@ -399,17 +367,13 @@ public function convert_string_to_passthru(
399367
* @param array $dats An optional array in which to return data messages.
400368
* @return bool `true` if a PDF file was generated successfully.
401369
*/
402-
public function convert_string_to_file(
370+
public function convertStringToFile(
403371
$inputString,
404372
$pdfPath,
405373
&$msgs = array(),
406374
&$dats = array()
407375
) {
408-
$pathAndArgs = $this->getCommandLine();
409-
$pathAndArgs .= '--structured-log=normal ';
410-
$pathAndArgs .= ' - -o "' . $pdfPath . '"';
411-
412-
return $this->stringToFile($pathAndArgs, $inputString, $msgs, $dats);
376+
return $this->convert_string_to_file($inputString, $pdfPath, $msgs, $dats);
413377
}
414378

415379
/* RASTERIZATION METHODS **************************************************/
@@ -2203,4 +2167,190 @@ private function cmdlineArgEscape2($argStr)
22032167

22042168
return $argStr;
22052169
}
2170+
2171+
/* PDF CONVERSION METHODS (DEPRECATED) ************************************/
2172+
2173+
/**
2174+
* [DEPRECATED]
2175+
* Convert an XML or HTML file to a PDF file. The name of the output PDF
2176+
* file will be the same as the name of the input file but with an extension
2177+
* of ".pdf".
2178+
*
2179+
* @deprecated 1.2.0 Prefer `convertFile` instead.
2180+
*
2181+
* @param string $inputPath The filename of the input XML or HTML document.
2182+
* @param array $msgs An optional array in which to return error and warning
2183+
* messages.
2184+
* @param array $dats An optional array in which to return data messages.
2185+
* @return bool `true` if a PDF file was generated successfully.
2186+
*/
2187+
public function convert_file($inputPath, &$msgs = array(), &$dats = array())
2188+
{
2189+
$pathAndArgs = $this->getCommandLine();
2190+
$pathAndArgs .= '--structured-log=normal ';
2191+
$pathAndArgs .= '"' . $inputPath . '"';
2192+
2193+
return $this->fileToFile($pathAndArgs, $msgs, $dats);
2194+
}
2195+
2196+
/**
2197+
* [DEPRECATED]
2198+
* Convert an XML or HTML file to a PDF file.
2199+
*
2200+
* @deprecated 1.2.0 Prefer `convertFileToFile` instead.
2201+
*
2202+
* @param string $inputPath The filename of the input XML or HTML document.
2203+
* @param string $pdfPath The filename of the output PDF file.
2204+
* @param array $msgs An optional array in which to return error and warning
2205+
* messages.
2206+
* @param array $dats An optional array in which to return data messages.
2207+
* @return bool `true` if a PDF file was generated successfully.
2208+
*/
2209+
public function convert_file_to_file(
2210+
$inputPath,
2211+
$pdfPath,
2212+
&$msgs = array(),
2213+
&$dats = array()
2214+
) {
2215+
$pathAndArgs = $this->getCommandLine();
2216+
$pathAndArgs .= '--structured-log=normal ';
2217+
$pathAndArgs .= '"' . $inputPath . '" -o "' . $pdfPath . '"';
2218+
2219+
return $this->fileToFile($pathAndArgs, $msgs, $dats);
2220+
}
2221+
2222+
/**
2223+
* [DEPRECATED]
2224+
* Convert multiple XML or HTML files to a PDF file.
2225+
*
2226+
* @deprecated 1.2.0 Prefer `convertMultipleFiles` instead.
2227+
*
2228+
* @param array $inputPaths An array of the input XML or HTML documents.
2229+
* @param string $pdfPath The filename of the output PDF file.
2230+
* @param array $msgs An optional array in which to return error and warning
2231+
* messages.
2232+
* @param array $dats An optional array in which to return data messages.
2233+
* @return bool `true` if a PDF file was generated successfully.
2234+
*/
2235+
public function convert_multiple_files(
2236+
$inputPaths,
2237+
$pdfPath,
2238+
&$msgs = array(),
2239+
&$dats = array()
2240+
) {
2241+
$pathAndArgs = $this->getCommandLine();
2242+
$pathAndArgs .= '--structured-log=normal ';
2243+
2244+
foreach ($inputPaths as $inputPath) {
2245+
$pathAndArgs .= '"' . $inputPath . '" ';
2246+
}
2247+
2248+
$pathAndArgs .= '-o "' . $pdfPath . '"';
2249+
2250+
return $this->fileToFile($pathAndArgs, $msgs, $dats);
2251+
}
2252+
2253+
/**
2254+
* [DEPRECATED]
2255+
* Convert multiple XML or HTML files to a PDF file, which will be passed
2256+
* through to the output buffer of the current PHP page.
2257+
*
2258+
* @deprecated 1.2.0 Prefer `convertMultipleFilesToPassthru` instead.
2259+
*
2260+
* @param array $inputPaths An array of the input XML or HTML documents.
2261+
* @param array $msgs An optional array in which to return error and warning
2262+
* messages.
2263+
* @param array $dats An optional array in which to return data messages.
2264+
* @return bool `true` if a PDF file was generated successfully.
2265+
*/
2266+
public function convert_multiple_files_to_passthru(
2267+
$inputPaths,
2268+
&$msgs = array(),
2269+
&$dats = array()
2270+
) {
2271+
$pathAndArgs = $this->getCommandLine();
2272+
$pathAndArgs .= '--structured-log=buffered ';
2273+
2274+
foreach ($inputPaths as $inputPath) {
2275+
$pathAndArgs .= '"' . $inputPath . '" ';
2276+
}
2277+
2278+
$pathAndArgs .= '-o -';
2279+
2280+
return $this->fileToPassthru($pathAndArgs, $msgs, $dats);
2281+
}
2282+
2283+
/**
2284+
* [DEPRECATED]
2285+
* Convert an XML or HTML file to a PDF file, which will be passed through
2286+
* to the output buffer of the current PHP page.
2287+
*
2288+
* @deprecated 1.2.0 Prefer `convertFileToPassthru` instead.
2289+
*
2290+
* @param string $inputPath The filename of the input XML or HTML document.
2291+
* @param array $msgs An optional array in which to return error and warning
2292+
* messages.
2293+
* @param array $dats An optional array in which to return data messages.
2294+
* @return bool `true` if a PDF file was generated successfully.
2295+
*/
2296+
public function convert_file_to_passthru(
2297+
$inputPath,
2298+
&$msgs = array(),
2299+
&$dats = array()
2300+
) {
2301+
$pathAndArgs = $this->getCommandLine();
2302+
$pathAndArgs .= '--structured-log=buffered "' . $inputPath . '" -o -';
2303+
2304+
return $this->fileToPassthru($pathAndArgs, $msgs, $dats);
2305+
}
2306+
2307+
/**
2308+
* [DEPRECATED]
2309+
* Convert an XML or HTML string to a PDF file, which will be passed through
2310+
* to the output buffer of the current PHP page.
2311+
*
2312+
* @deprecated 1.2.0 Prefer `convertStringToPassthru` instead.
2313+
*
2314+
* @param string $inputString A string containing an XML or HTML document.
2315+
* @param array $msgs An optional array in which to return error and warning
2316+
* messages.
2317+
* @param array $dats An optional array in which to return data messages.
2318+
* @return bool `true` if a PDF file was generated successfully.
2319+
*/
2320+
public function convert_string_to_passthru(
2321+
$inputString,
2322+
&$msgs = array(),
2323+
&$dats = array()
2324+
) {
2325+
$pathAndArgs = $this->getCommandLine();
2326+
$pathAndArgs .= '--structured-log=buffered -';
2327+
2328+
return $this->stringToPassthru($pathAndArgs, $inputString, $msgs, $dats);
2329+
}
2330+
2331+
/**
2332+
* [DEPRECATED]
2333+
* Convert an XML or HTML string to a PDF file.
2334+
*
2335+
* @deprecated 1.2.0 Prefer `convertStringToFile` instead.
2336+
*
2337+
* @param string $inputString A string containing an XML or HTML document.
2338+
* @param string $pdfPath The filename of the output PDF file.
2339+
* @param array $msgs An optional array in which to return error and warning
2340+
* messages.
2341+
* @param array $dats An optional array in which to return data messages.
2342+
* @return bool `true` if a PDF file was generated successfully.
2343+
*/
2344+
public function convert_string_to_file(
2345+
$inputString,
2346+
$pdfPath,
2347+
&$msgs = array(),
2348+
&$dats = array()
2349+
) {
2350+
$pathAndArgs = $this->getCommandLine();
2351+
$pathAndArgs .= '--structured-log=normal ';
2352+
$pathAndArgs .= ' - -o "' . $pdfPath . '"';
2353+
2354+
return $this->stringToFile($pathAndArgs, $inputString, $msgs, $dats);
2355+
}
22062356
}

0 commit comments

Comments
 (0)