From fea91e4de6c2bee91aff86b2c0a018c0ff11b828 Mon Sep 17 00:00:00 2001 From: murdercode Date: Thu, 29 Feb 2024 21:59:30 +0000 Subject: [PATCH] Fix styling --- src/Readability.php | 7 ++----- tests/ReadabilityTest.php | 12 ++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Readability.php b/src/Readability.php index 9906b81..c583f2b 100755 --- a/src/Readability.php +++ b/src/Readability.php @@ -18,8 +18,8 @@ public function parse(string $content): self $this->content->parse($content); } catch (ParseException $e) { $this->content = null; - error_log('Cannot parse: ' . $e->getMessage()); - throw new Exception('Cannot parse: ' . $e->getMessage()); + error_log('Cannot parse: '.$e->getMessage()); + throw new Exception('Cannot parse: '.$e->getMessage()); } return $this; @@ -68,8 +68,6 @@ public function getImage(): string /** * Return the images of the content - * - * @return array */ public function getImages(): array { @@ -108,5 +106,4 @@ private function checkContent(): void throw new Exception('Content is null. Did you forget to call parse()?'); } } - } diff --git a/tests/ReadabilityTest.php b/tests/ReadabilityTest.php index 1728ca3..551afb3 100644 --- a/tests/ReadabilityTest.php +++ b/tests/ReadabilityTest.php @@ -10,31 +10,31 @@ }); it('can parse and get the title', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $title = Readability::parse($content)->getTitle(); expect($title)->toBe('Bitcoin: A Peer-to-Peer Electronic Cash System'); }); it('can parse and get excerpt', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $excerpt = Readability::parse($content)->getExcerpt(); expect($excerpt)->toBe('A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.'); }); it('can parse and get the author', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $author = Readability::parse($content)->getAuthor(); expect($author)->toBe('Satoshi Nakamoto'); }); it('can parse and get the image', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $image = Readability::parse($content)->getImage(); expect($image)->toBe('https://www.bitcoin.com/wp-content/uploads/2020/10/bitcoin-whitepaper-featured-image.jpg'); }); it('can parse and get images', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $images = Readability::parse($content)->getImages(); expect($images)->toBeArray()->toHaveCount(8); expect($images)->toContain('https://www.bitcoin.com/wp-content/uploads/2020/10/bitcoin-whitepaper-featured-image.jpg'); @@ -48,7 +48,7 @@ }); it('can parse and get the content', function () { - $content = file_get_contents(__DIR__ . '/fixtures/demo.html'); + $content = file_get_contents(__DIR__.'/fixtures/demo.html'); $readability = Readability::parse($content); $readability->getContent(); expect($readability)->not->toBeNull();