Files
piratepoet/lib/Referrals/UrlDecorator.php
Jan Jakeš 01a0fe96c4 Remove no longer necessary checks
[MAILPOET-1948]
2019-09-12 13:59:32 +02:00

29 lines
615 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;
function __construct(WPFunctions $wp, SettingsController $settings) {
$this->wp = $wp;
$this->settings = $settings;
}
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);
}
}