Use DI to initialize PermanentNotices

[MAILPOET-2088]
This commit is contained in:
Jan Jakeš
2019-05-31 15:39:41 +02:00
committed by M. Shull
parent 0e99d7982c
commit 74a4ff5a2f
3 changed files with 17 additions and 11 deletions

View File

@@ -8,6 +8,9 @@ use MailPoet\WP\Functions as WPFunctions;
class PermanentNotices {
/** @var WPFunctions */
private $wp;
/** @var PHPVersionWarnings */
private $php_version_warnings;
@@ -26,17 +29,14 @@ class PermanentNotices {
/** @var InactiveSubscribersNotice */
private $inactive_subscribers_notice;
/** @var WPFunctions */
private $wp;
public function __construct() {
$this->wp = WPFunctions::get();
public function __construct(WPFunctions $wp) {
$this->wp = $wp;
$this->php_version_warnings = new PHPVersionWarnings();
$this->after_migration_notice = new AfterMigrationNotice();
$this->discounts_announcement = new DiscountsAnnouncement();
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $this->wp);
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $this->wp);
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $this->wp);
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $wp);
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $wp);
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $wp);
}
public function init() {