Files
piratepoet/lib/Util/Installation.php
Amine Ben hammou 43df66d162 Add public keyword to methods
[MAILPOET-2413]
2019-12-26 18:09:45 +03:00

33 lines
865 B
PHP

<?php
namespace MailPoet\Util;
use MailPoet\Settings\SettingsController;
use MailPoet\WP\Functions as WPFunctions;
use MailPoetVendor\Carbon\Carbon;
class Installation {
const NEW_INSTALLATION_DAYS_LIMIT = 30;
/** @var SettingsController */
private $settings;
/** @var WPFunctions */
private $wp;
public function __construct(SettingsController $settings, WPFunctions $wp) {
$this->settings = $settings;
$this->wp = $wp;
}
public function isNewInstallation() {
$installed_at = $this->settings->get('installed_at');
if (is_null($installed_at)) {
return true;
}
$installed_at = Carbon::createFromTimestamp(strtotime($installed_at));
$current_time = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
return $current_time->diffInDays($installed_at) <= self::NEW_INSTALLATION_DAYS_LIMIT;
}
}