Skip to content

Commit

Permalink
1.3.4
Browse files Browse the repository at this point in the history
- BREAKING CHANGE: `extrasExtract()` is now `extra()`
- `chore`: `kiwilan/php-xml-reader` to 0.2.30
  • Loading branch information
ewilan-riviere committed Jun 28, 2023
1 parent 819a662 commit e5217be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Some metadata can be stored into `extras()` method, without typing, directly fro

```php
$ebook->extras(); // array<string, mixed> => additional data for book
$ebook->extrasExtract(string $key); // mixed => safely extract data from `extras` array
$ebook->extra(string $key); // mixed => safely extract data from `extras` array
```

To get additional data, you can use these methods:
Expand Down
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.36",
"version": "1.3.4",
"keywords": [
"php",
"ebook",
Expand Down
2 changes: 1 addition & 1 deletion src/Ebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public function extras(): array
/**
* Get key from `extras` safely.
*/
public function extrasExtract(string $key): mixed
public function extra(string $key): mixed
{
if (! array_key_exists($key, $this->extras)) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions tests/EpubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
expect($ebook->extras()['contributor'])->toBeString();
expect($ebook->extras()['rating'])->toBeFloat();
expect($ebook->extras()['rating'])->toBe(10.0);
expect($ebook->extrasExtract('contributor'))->toBeString();
expect($ebook->extrasExtract('contributora'))->toBeNull();
expect($ebook->extra('contributor'))->toBeString();
expect($ebook->extra('contributora'))->toBeNull();

$metadata = $ebook->metadata();
expect($metadata->toArray())->toBeArray();
Expand Down

0 comments on commit e5217be

Please sign in to comment.