Move WPHooks methods to WPFunctions

This commit is contained in:
Amine Ben hammou
2019-01-28 19:00:19 +01:00
parent d452cfcae7
commit 8b602bd947
49 changed files with 354 additions and 258 deletions

View File

@ -4,7 +4,7 @@ namespace MailPoet\Analytics;
use Carbon\Carbon;
use MailPoet\Models\Setting;
use MailPoet\WP\Hooks as WPHooks;
use MailPoet\WP\Functions as WPFunctions;
if(!defined('ABSPATH')) exit;
@ -16,15 +16,17 @@ class Analytics {
/** @var Reporter */
private $reporter;
private $wp;
public function __construct(Reporter $reporter) {
$this->reporter = $reporter;
$this->wp = new WPFunctions;
}
/** @return array */
function generateAnalytics() {
if($this->shouldSend()) {
$data = WPHooks::applyFilters(self::ANALYTICS_FILTER, $this->reporter->getData());
$data = $this->wp->applyFilters(self::ANALYTICS_FILTER, $this->reporter->getData());
$this->recordDataSent();
return $data;
}