Files
piratepoet/lib/Referrals/UrlDecorator.php
Amine Ben hammou 43df66d162 Add public keyword to methods
[MAILPOET-2413]
2019-12-26 18:09:45 +03:00

29 lines
629 B
PHP

<?php
namespace MailPoet\Referrals;
use MailPoet\Settings\SettingsController;
use MailPoet\WP\Functions as WPFunctions;
class UrlDecorator {
/** @var WPFunctions */
private $wp;
/** @var SettingsController */
private $settings;
public function __construct(WPFunctions $wp, SettingsController $settings) {
$this->wp = $wp;
$this->settings = $settings;
}
public function decorate($url) {
$referral_id = $this->settings->get(ReferralDetector::REFERRAL_SETTING_NAME, null);
if ($referral_id === null) {
return $url;
}
return $this->wp->addQueryArg('ref', $referral_id, $url);
}
}