Skip to content

Commit 12ee172

Browse files
laurynas-convertapiLaurynas Butkus
andauthored
Remove alternative converter support (#61)
Co-authored-by: Laurynas Butkus <laurynas@baltsoft.com>
1 parent d617d95 commit 12ee172

File tree

4 files changed

+2
-43
lines changed

4 files changed

+2
-43
lines changed

examples/alternative_converter.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/error_handling.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
ConvertApi::setApiSecret(getenv('CONVERT_API_SECRET'));
88

99
try {
10-
$result = ConvertApi::convert('png', ['File' => 'files/test.docx', 'converter' => 'DUMMY']);
10+
$result = ConvertApi::convert('svg', ['File' => 'files/test.docx']);
1111
} catch (\ConvertApi\Error\Api $error) {
1212
echo "Got API error code: " . $error->getCode() . "\n";
1313
echo $error->getMessage();

lib/ConvertApi/Task.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ function run()
3636
}
3737

3838
$fromFormat = $this->fromFormat ?: $this->detectFormat($params);
39-
$converter = $this->detectConverter($params);
40-
$converterPath = $converter ? "/converter/{$converter}" : '';
41-
$path = 'convert/' . $fromFormat . '/to/' . $this->toFormat . $converterPath;
39+
$path = 'convert/' . $fromFormat . '/to/' . $this->toFormat;
4240

4341
$response = ConvertApi::client()->post($path, $params, $readTimeout);
4442

@@ -97,15 +95,4 @@ private function detectFormat($params)
9795

9896
return $detector->run();
9997
}
100-
101-
private function detectConverter($params)
102-
{
103-
$keys = array_keys($params);
104-
105-
foreach ($keys as $key)
106-
if (strtolower($key) == 'converter')
107-
return $params[$key];
108-
109-
return;
110-
}
11198
}

tests/ConvertApi/ConvertApiTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,6 @@ public function testConvertWithStoreFileFalse()
117117
$this->assertEquals('test.pdf', $result->getFile()->getFileName());
118118
}
119119

120-
public function testConvertWithAltnativeConverter()
121-
{
122-
$params = ['File' => 'examples/files/test.docx', 'converter' => 'openoffice'];
123-
124-
$result = ConvertApi::convert('pdf', $params);
125-
126-
$this->assertEquals('test.pdf', $result->getFile()->getFileName());
127-
}
128-
129120
public function testConvertWithFileUpload()
130121
{
131122
$fileUpload = new \ConvertApi\FileUpload('examples/files/test.docx', 'custom.docx');

0 commit comments

Comments
 (0)