Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ public function language(string|LanguageCodeEnum $language): self

public function isOverlayRequired(bool $isRequired): self
{
$this->requestParameters->attach(RequestParameterEnum::IS_OVERLAY_REQUIRED, $isRequired);
$this->requestParameters->attach(RequestParameterEnum::IS_OVERLAY_REQUIRED, $isRequired === true ? "true" : "false");
return $this;
}

public function detectOrientation(bool $detectOrientation): self
{
$this->requestParameters->attach(RequestParameterEnum::DETECT_ORIENTATION, $detectOrientation);
$this->requestParameters->attach(RequestParameterEnum::DETECT_ORIENTATION, $detectOrientation === true ? "true" : "false");
return $this;
}

Expand All @@ -209,25 +209,25 @@ public function fileType(string|FileTypeEnum $fileType): self

public function isCreateSearchablePdf(bool $isCreateSearchablePdf): self
{
$this->requestParameters->attach(RequestParameterEnum::IS_CREATE_SEARCHABLE_PDF, $isCreateSearchablePdf);
$this->requestParameters->attach(RequestParameterEnum::IS_CREATE_SEARCHABLE_PDF, $isCreateSearchablePdf === true ? "true" : "false");
return $this;
}

public function isSearchablePdfHideTextLayer(bool $isSearchablePdfHideTextLayer): self
{
$this->requestParameters->attach(RequestParameterEnum::IS_SEARCHABLE_PDF_HIDE_TEXT_LAYER, $isSearchablePdfHideTextLayer);
$this->requestParameters->attach(RequestParameterEnum::IS_SEARCHABLE_PDF_HIDE_TEXT_LAYER, $isSearchablePdfHideTextLayer === true ? "true" : "false");
return $this;
}

public function scale(bool $scale): self
{
$this->requestParameters->attach(RequestParameterEnum::SCALE, $scale);
$this->requestParameters->attach(RequestParameterEnum::SCALE, $scale === true ? "true" : "false");
return $this;
}

public function isTable(bool $isTable): self
{
$this->requestParameters->attach(RequestParameterEnum::IS_TABLE, $isTable);
$this->requestParameters->attach(RequestParameterEnum::IS_TABLE, $isTable === true ? "true" : "false");
return $this;
}

Expand Down
26 changes: 13 additions & 13 deletions tests/Feature/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,25 @@ public function testIsOverlayRequiredSetsCorrectParameter(): void
$client = $this->client->isOverlayRequired(true);
$options = $client->options();
$this->assertArrayHasKey('isOverlayRequired', $options);
$this->assertTrue($options['isOverlayRequired']);
$this->assertSame("true", $options['isOverlayRequired']);

$client = $this->client->isOverlayRequired(false);
$options = $client->options();
$this->assertArrayHasKey('isOverlayRequired', $options);
$this->assertFalse($options['isOverlayRequired']);
$this->assertSame("false", $options['isOverlayRequired']);
}

public function testDetectOrientationSetsCorrectParameter(): void
{
$client = $this->client->detectOrientation(true);
$options = $client->options();
$this->assertArrayHasKey('detectOrientation', $options);
$this->assertTrue($options['detectOrientation']);
$this->assertSame("true", $options['detectOrientation']);

$client = $this->client->detectOrientation(false);
$options = $client->options();
$this->assertArrayHasKey('detectOrientation', $options);
$this->assertFalse($options['detectOrientation']);
$this->assertSame("false", $options['detectOrientation']);
}

#[DataProvider('fileTypeDataProvider')]
Expand All @@ -186,51 +186,51 @@ public function testIsCreateSearchablePdfSetsCorrectParameter(): void
$client = $this->client->isCreateSearchablePdf(true);
$options = $client->options();
$this->assertArrayHasKey('isCreateSearchablePdf', $options);
$this->assertTrue($options['isCreateSearchablePdf']);
$this->assertSame("true", $options['isCreateSearchablePdf']);

$client = $this->client->isCreateSearchablePdf(false);
$options = $client->options();
$this->assertArrayHasKey('isCreateSearchablePdf', $options);
$this->assertFalse($options['isCreateSearchablePdf']);
$this->assertSame("false", $options['isCreateSearchablePdf']);
}

public function testIsSearchablePdfHideTextLayerSetsCorrectParameter(): void
{
$client = $this->client->isSearchablePdfHideTextLayer(true);
$options = $client->options();
$this->assertArrayHasKey('isSearchablePdfHideTextLayer', $options);
$this->assertTrue($options['isSearchablePdfHideTextLayer']);
$this->assertSame("true", $options['isSearchablePdfHideTextLayer']);

$client = $this->client->isSearchablePdfHideTextLayer(false);
$options = $client->options();
$this->assertArrayHasKey('isSearchablePdfHideTextLayer', $options);
$this->assertFalse($options['isSearchablePdfHideTextLayer']);
$this->assertSame("false", $options['isSearchablePdfHideTextLayer']);
}

public function testScaleSetsCorrectParameter(): void
{
$client = $this->client->scale(true);
$options = $client->options();
$this->assertArrayHasKey('scale', $options);
$this->assertTrue($options['scale']);
$this->assertSame("true", $options['scale']);

$client = $this->client->scale(false);
$options = $client->options();
$this->assertArrayHasKey('scale', $options);
$this->assertFalse($options['scale']);
$this->assertSame("false", $options['scale']);
}

public function testIsTableSetsCorrectParameter(): void
{
$client = $this->client->isTable(true);
$options = $client->options();
$this->assertArrayHasKey('isTable', $options);
$this->assertTrue($options['isTable']);
$this->assertSame("true", $options['isTable']);

$client = $this->client->isTable(false);
$options = $client->options();
$this->assertArrayHasKey('isTable', $options);
$this->assertFalse($options['isTable']);
$this->assertSame("false", $options['isTable']);
}

#[DataProvider('engineDataProvider')]
Expand Down Expand Up @@ -280,7 +280,7 @@ public function testOptionsReturnsCorrectParameters(): void
$this->assertArrayHasKey('language', $options);
$this->assertSame('ara', $options['language']);
$this->assertArrayHasKey('isOverlayRequired', $options);
$this->assertTrue($options['isOverlayRequired']);
$this->assertSame("true", $options['isOverlayRequired']);
$this->assertArrayHasKey('filetype', $options);
$this->assertSame('PDF', $options['filetype']);
$this->assertArrayHasKey('OCREngine', $options);
Expand Down