From a2bfd7e7087ea32c6c14debc379a98aac6b51a6d Mon Sep 17 00:00:00 2001 From: Claudio-Emmolo Date: Wed, 30 Aug 2023 09:25:19 +0000 Subject: [PATCH] Fix styling --- src/ReferralRewriterTag.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/ReferralRewriterTag.php b/src/ReferralRewriterTag.php index 8c9bb07..85076b3 100755 --- a/src/ReferralRewriterTag.php +++ b/src/ReferralRewriterTag.php @@ -4,16 +4,18 @@ class ReferralRewriterTag { - protected ?string $link; + protected ?string $tag; + protected ?string $subtag; + protected ?string $additionalQuery; /** * Start function */ - public function rewrite(string $link, ?string $tag, ?string $subtag, ?string $additionalQuery = null): string + public function rewrite(string $link, ?string $tag, ?string $subtag, string $additionalQuery = null): string { $this->link = $link; $this->tag = $tag; @@ -39,20 +41,19 @@ public function rewriteAmazonLink(): string /** * Rewrite instant gaming link with tag and subtag */ - public function rewriteInstantGamingLink() : string - { + public function rewriteInstantGamingLink(): string + { return $this->rewriteLink(tagKey: 'igr', subTagKey: 'igr_extra'); - } + } /** * Rewrite ebay link with tag and subtag */ - public function rewriteEbayLink() : string + public function rewriteEbayLink(): string { return $this->rewriteLink(tagKey: 'campid', subTagKey: 'customid'); } - /** * Retrieve the domain type */ @@ -77,15 +78,16 @@ public function rewriteLink(string $tagKey, string $subTagKey): string|array|nul parse_str($urlComponents['query'], $queryParams); } - if($this->tag){ + if ($this->tag) { $queryParams[$tagKey] = $this->tag; } - if($this->subtag){ + if ($this->subtag) { $queryParams[$subTagKey] = $this->subtag; } $newQueryParams = http_build_query($queryParams); - return $urlComponents['scheme'] . '://' . $urlComponents['host'] . $urlComponents['path'] . '?' . $newQueryParams . $this->additionalQuery; + + return $urlComponents['scheme'].'://'.$urlComponents['host'].$urlComponents['path'].'?'.$newQueryParams.$this->additionalQuery; } }