Files
piratepoet/lib/Settings/TrackingConfig.php
Rostislav Wolny 4bc7f3c2bc Add service for distributing tracking configuration in the plugin
We introduced new settings that enable set different levels (basic, partial, full) of user tracking.
Each level enables different tracking options. This service should encapsulate the logic that determines
what should be tracked on each level of the setting.
[MAILPOET-3185]
2021-12-06 17:03:28 +01:00

27 lines
674 B
PHP

<?php declare(strict_types=1);
namespace MailPoet\Settings;
class TrackingConfig {
const LEVEL_FULL = 'full';
const LEVEL_PARTIAL = 'partial';
const LEVEL_BASIC = 'basic';
/** @var SettingsController */
private $settings;
public function __construct(
SettingsController $settings
) {
$this->settings = $settings;
}
public function isEmailTrackingEnabled(): bool {
return in_array($this->settings->get('tracking.level', self::LEVEL_FULL), [self::LEVEL_PARTIAL, self::LEVEL_FULL], true);
}
public function isCookieTrackingEnabled(): bool {
return $this->settings->get('tracking.level', self::LEVEL_FULL) === self::LEVEL_FULL;
}
}