Skip to content

Commit

Permalink
Merge pull request #20 from kiwilan/develop
Browse files Browse the repository at this point in the history
1.3.32
  • Loading branch information
ewilan-riviere committed Jun 22, 2023
2 parents bdbe92e + b3eb5ba commit 14aafc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiwilan/php-ebook",
"description": "PHP package to read metadata and extract covers from eBooks (.epub, .cbz, .cbr, .cb7, .cbt, .pdf) and audiobooks (.mp3, .m4a, .m4b, .flac, .ogg).",
"version": "1.3.31",
"version": "1.3.32",
"keywords": [
"php",
"ebook",
Expand Down
6 changes: 5 additions & 1 deletion src/Ebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,12 @@ public function hasCover(): bool
return $this->cover !== null;
}

private function limitLength(string $string, int $length): string
private function limitLength(?string $string, int $length): ?string
{
if (! $string) {
return null;
}

if (mb_strlen($string) <= $length) {
return $string;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/EpubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
expect($ebook->authorMain()->name())->toBe('Jean M. Auel');
expect($ebook->authors())->toBeArray();
expect($firstAuthor->name())->toBe('Jean M. Auel');
expect($ebook->description())->toBeString();
expect($ebook->copyright())->toBe('Copyright © 1980 by Jean M. Auel');
expect($ebook->description(1500))->toBeString();
expect($ebook->copyright(255))->toBe('Copyright © 1980 by Jean M. Auel');
expect($ebook->copyright(10))->toBe('Copyright…');
expect($ebook->publisher())->toBe('Hodder & Stoughton');
expect($ebook->identifiers())->toBeArray();
expect($ebook->identifiers()['google']->value())->toBe('ASvHBAAAQBAJ');
Expand Down

0 comments on commit 14aafc3

Please sign in to comment.