diff --git a/src/Embed/Embed.php b/src/Embed/Embed.php index 40dec3f..f7d9aed 100644 --- a/src/Embed/Embed.php +++ b/src/Embed/Embed.php @@ -18,7 +18,7 @@ public static function getParsers(): array { $namespace = __NAMESPACE__ . '\\Platforms\\'; return array_map( - fn($file) => $namespace . pathinfo((string)$file, PATHINFO_FILENAME), + fn ($file) => $namespace . pathinfo((string)$file, PATHINFO_FILENAME), (array)glob(__DIR__ . '/Platforms/*.php') ); } diff --git a/src/Exception/LinkScrapeException.php b/src/Exception/LinkScrapeException.php index ab22495..6c0b43e 100644 --- a/src/Exception/LinkScrapeException.php +++ b/src/Exception/LinkScrapeException.php @@ -4,5 +4,4 @@ class LinkScrapeException extends UnfoldException { - -} \ No newline at end of file +} diff --git a/src/Link/Metadata/MetadataObject.php b/src/Link/Metadata/MetadataObject.php index da124f1..eaf288d 100644 --- a/src/Link/Metadata/MetadataObject.php +++ b/src/Link/Metadata/MetadataObject.php @@ -2,7 +2,6 @@ namespace Hyvor\Unfold\Link\Metadata; - use Hyvor\Unfold\Unfolded\UnfoldedAuthor; use Hyvor\Unfold\Unfolded\UnfoldedTag; @@ -11,7 +10,6 @@ */ class MetadataObject { - /** * @param MetadataKeyType $key * @param T $value diff --git a/src/Link/Metadata/MetadataParser.php b/src/Link/Metadata/MetadataParser.php index ca11be7..c9840d0 100644 --- a/src/Link/Metadata/MetadataParser.php +++ b/src/Link/Metadata/MetadataParser.php @@ -12,13 +12,10 @@ use Hyvor\Unfold\Link\Metadata\Parsers\OgParser; use Hyvor\Unfold\Link\Metadata\Parsers\TitleParser; use Hyvor\Unfold\Link\Metadata\Parsers\TwitterParser; -use Hyvor\Unfold\Unfolded\UnfoldedAuthor; -use Hyvor\Unfold\Unfolded\UnfoldedTag; use Symfony\Component\DomCrawler\Crawler; class MetadataParser { - /** * @var MetadataObject[] */ diff --git a/src/Link/Metadata/MetadataPriority.php b/src/Link/Metadata/MetadataPriority.php index 56f6ce6..dc90f96 100644 --- a/src/Link/Metadata/MetadataPriority.php +++ b/src/Link/Metadata/MetadataPriority.php @@ -57,7 +57,7 @@ private function prioritizedAll(array $keys) * 'OG_TITLE' => [MetadataObject], * ] */ - $keysNames = array_map(fn($key) => $key->name, $keys); + $keysNames = array_map(fn ($key) => $key->name, $keys); uksort($keyedMetadata, function ($a, $b) use ($keysNames) { return intval(array_search($a, $keysNames)) - intval(array_search($b, $keysNames)); }); @@ -65,7 +65,7 @@ private function prioritizedAll(array $keys) // index by 0,1,2 $keyedMetadata = array_values($keyedMetadata); // return the values - return array_map(fn($metadata) => $metadata->value, $keyedMetadata[0] ?? []); + return array_map(fn ($metadata) => $metadata->value, $keyedMetadata[0] ?? []); } /** diff --git a/src/UnfoldConfig.php b/src/UnfoldConfig.php index ea88121..bc7007a 100644 --- a/src/UnfoldConfig.php +++ b/src/UnfoldConfig.php @@ -81,8 +81,7 @@ public function __construct( public ?string $facebookAccessToken = null, // CACHE - ) - { + ) { $this->setHttpClient($httpClient); } diff --git a/src/Unfolded/Unfolded.php b/src/Unfolded/Unfolded.php index 36ff3fd..85ad5ba 100644 --- a/src/Unfolded/Unfolded.php +++ b/src/Unfolded/Unfolded.php @@ -4,7 +4,6 @@ use DateTimeInterface; use Hyvor\Unfold\Embed\EmbedResponseObject; -use Hyvor\Unfold\Link\Metadata\MetadataKeyType; use Hyvor\Unfold\Link\Metadata\MetadataObject; use Hyvor\Unfold\Link\Metadata\MetadataPriority; use Hyvor\Unfold\UnfoldCallContext; diff --git a/tests/Feature/UnfoldEmbedTest.php b/tests/Feature/UnfoldEmbedTest.php index e8f2c35..b29702b 100644 --- a/tests/Feature/UnfoldEmbedTest.php +++ b/tests/Feature/UnfoldEmbedTest.php @@ -65,9 +65,9 @@ }); it('on unable to resolve', function () { - expect(fn() => Unfold::unfold( + expect(fn () => Unfold::unfold( 'https://hyvor.com', method: UnfoldMethod::EMBED, config: new UnfoldConfig() ))->toThrow(EmbedUnableToResolveException::class); -}); \ No newline at end of file +}); diff --git a/tests/Feature/UnfoldLinkTest.php b/tests/Feature/UnfoldLinkTest.php index cd370b1..e0c8e74 100644 --- a/tests/Feature/UnfoldLinkTest.php +++ b/tests/Feature/UnfoldLinkTest.php @@ -11,7 +11,10 @@ it('fetches link success', function () { $mock = new MockHandler([ - new Response(200, [], <<