diff --git a/README.md b/README.md index 7c75549..22561b4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ConvertAPI helps in converting various file formats. Creating PDF and Images fro ## Requirements -PHP 5.4.0 and later. +PHP 8.1.0 and later. ## Installation diff --git a/examples/conversions_chaining.php b/examples/conversions_chaining.php index 2e724d6..de4593f 100644 --- a/examples/conversions_chaining.php +++ b/examples/conversions_chaining.php @@ -18,14 +18,14 @@ $cost = $jpgResult->getConversionCost(); $count = count($jpgResult->getFiles()); -echo "Conversions done. Cost: ${cost}. Total files created: ${count}\n"; +echo "Conversions done. Cost: {$cost}. Total files created: {$count}\n"; $zipResult = ConvertApi::convert('zip', ['Files' => $jpgResult->getFiles()], 'any'); $cost = $zipResult->getConversionCost(); $count = count($zipResult->getFiles()); -echo "Conversions done. Cost: ${cost}. Total files created: ${count}\n"; +echo "Conversions done. Cost: {$cost}. Total files created: {$count}\n"; $savedFiles = $zipResult->saveFiles($dir); diff --git a/lib/ConvertApi/Client.php b/lib/ConvertApi/Client.php index ed4513b..2bdef4a 100644 --- a/lib/ConvertApi/Client.php +++ b/lib/ConvertApi/Client.php @@ -44,7 +44,7 @@ public function upload($file_or_resource, $fileName) if (!$fp) { - throw new Error\File("Unable to open file ${file_or_resource}"); + throw new Error\File("Unable to open file {$file_or_resource}"); } curl_setopt($ch, CURLOPT_POST, true); @@ -72,7 +72,7 @@ public function download($url, $path) if (!$fp) { - throw new Error\File("Unable to open file ${path}"); + throw new Error\File("Unable to open file {$path}"); } curl_setopt($ch, CURLOPT_FILE, $fp); @@ -193,7 +193,7 @@ private function buildFormData($params) if (is_array($val)) { foreach ($val as $k => $v) - $data["${key}[${k}]"] = $v; + $data["{$key}[{$k}]"] = $v; } elseif (is_bool($val)) $data[$key] = $val ? 'true' : 'false'; diff --git a/lib/ConvertApi/FileUpload.php b/lib/ConvertApi/FileUpload.php index 5779157..11779c3 100644 --- a/lib/ConvertApi/FileUpload.php +++ b/lib/ConvertApi/FileUpload.php @@ -4,6 +4,10 @@ class FileUpload { + public $filePath; + private string $_fileName; + private array $_result; + function __construct($filePath, $fileName = null) { $this->filePath = $filePath; diff --git a/lib/ConvertApi/FormatDetector.php b/lib/ConvertApi/FormatDetector.php index 41bc458..e93d30d 100644 --- a/lib/ConvertApi/FormatDetector.php +++ b/lib/ConvertApi/FormatDetector.php @@ -4,6 +4,8 @@ class FormatDetector { + private $resource; + function __construct($resource) { $this->resource = $resource; diff --git a/lib/ConvertApi/Result.php b/lib/ConvertApi/Result.php index f719131..571977e 100644 --- a/lib/ConvertApi/Result.php +++ b/lib/ConvertApi/Result.php @@ -4,7 +4,8 @@ class Result { - private $files; + private array $files; + public array $response; function __construct($response) { diff --git a/lib/ConvertApi/ResultFile.php b/lib/ConvertApi/ResultFile.php index e3c9fe9..e84ec62 100644 --- a/lib/ConvertApi/ResultFile.php +++ b/lib/ConvertApi/ResultFile.php @@ -4,6 +4,8 @@ class ResultFile { + public array $fileInfo; + function __construct($fileInfo) { $this->fileInfo = $fileInfo; diff --git a/lib/ConvertApi/Task.php b/lib/ConvertApi/Task.php index fca394e..29baf1d 100644 --- a/lib/ConvertApi/Task.php +++ b/lib/ConvertApi/Task.php @@ -6,6 +6,11 @@ class Task { const DEFAULT_URL_FORMAT = 'url'; + private ?string $fromFormat; + private ?string $toFormat; + private array $params; + private ?int $conversionTimeout; + function __construct($fromFormat, $toFormat, $params, $conversionTimeout = null) { $this->fromFormat = $fromFormat;