Files
piratepoet/lib/Referrals/UrlDecorator.php
Jan Jakeš 54549ff037 Convert variable names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00

29 lines
626 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) {
$referralId = $this->settings->get(ReferralDetector::REFERRAL_SETTING_NAME, null);
if ($referralId === null) {
return $url;
}
return $this->wp->addQueryArg('ref', $referralId, $url);
}
}