diff --git a/GenericLinkProvider.php b/GenericLinkProvider.php index 3df2f98..78c319d 100644 --- a/GenericLinkProvider.php +++ b/GenericLinkProvider.php @@ -45,7 +45,7 @@ public function getLinksByRel(string $rel): array $links = []; foreach ($this->links as $link) { - if (\in_array($rel, $link->getRels())) { + if (\in_array($rel, $link->getRels(), true)) { $links[] = $link; } } diff --git a/HttpHeaderSerializer.php b/HttpHeaderSerializer.php index 2ecdff0..4d537c9 100644 --- a/HttpHeaderSerializer.php +++ b/HttpHeaderSerializer.php @@ -35,18 +35,18 @@ public function serialize(iterable $links): ?string continue; } - $attributesParts = ['', sprintf('rel="%s"', implode(' ', $link->getRels()))]; + $attributesParts = ['', \sprintf('rel="%s"', implode(' ', $link->getRels()))]; foreach ($link->getAttributes() as $key => $value) { if (\is_array($value)) { foreach ($value as $v) { - $attributesParts[] = sprintf('%s="%s"', $key, preg_replace('/(?%s', $link->getHref(), implode('; ', $attributesParts)); + $elements[] = \sprintf('<%s>%s', $link->getHref(), implode('; ', $attributesParts)); } return $elements ? implode(',', $elements) : null; diff --git a/Link.php b/Link.php index ebad518..1f5fbbd 100644 --- a/Link.php +++ b/Link.php @@ -147,8 +147,6 @@ class Link implements EvolvableLinkInterface // Extra relations public const REL_MERCURE = 'mercure'; - private string $href = ''; - /** * @var string[] */ @@ -159,12 +157,13 @@ class Link implements EvolvableLinkInterface */ private array $attributes = []; - public function __construct(?string $rel = null, string $href = '') - { + public function __construct( + ?string $rel = null, + private string $href = '', + ) { if (null !== $rel) { $this->rel[$rel] = $rel; } - $this->href = $href; } public function getHref(): string diff --git a/README.md b/README.md index fe33a9c..7e958a0 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ wiki](http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extension Getting Started --------------- -``` -$ composer require symfony/web-link +```bash +composer require symfony/web-link ``` ```php diff --git a/Tests/LinkTest.php b/Tests/LinkTest.php index e1c03ba..226bc3a 100644 --- a/Tests/LinkTest.php +++ b/Tests/LinkTest.php @@ -45,7 +45,7 @@ public function testCanRemoveValues() ->withoutRel('next'); $this->assertEquals('http://www.google.com', $link->getHref()); - $this->assertFalse(\in_array('next', $link->getRels())); + $this->assertFalse(\in_array('next', $link->getRels(), true)); $this->assertArrayNotHasKey('me', $link->getAttributes()); } diff --git a/composer.json b/composer.json index 8537f78..3203f6f 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,14 @@ "psr/link-implementation": "1.0|2.0" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "psr/link": "^1.1|^2.0" }, "require-dev": { - "symfony/http-kernel": "^5.4|^6.0|^7.0" + "symfony/http-kernel": "^6.4|^7.0" }, "conflict": { - "symfony/http-kernel": "<5.4" + "symfony/http-kernel": "<6.4" }, "autoload": { "psr-4": { "Symfony\\Component\\WebLink\\": "" },
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: