Encapsulate date formatting within the DateTime class [PREMIUM-4]

This commit is contained in:
Alexey Stoletniy
2017-05-09 08:54:12 +03:00
parent 90b2b46db4
commit 2eb98905b6
4 changed files with 18 additions and 7 deletions

View File

@ -1,7 +1,6 @@
<?php
namespace MailPoet\API\Endpoints\v1;
use Carbon\Carbon;
use MailPoet\API\Endpoint as APIEndpoint;
use MailPoet\API\Error as APIError;
use MailPoet\Services\Bridge;
@ -44,8 +43,7 @@ class Services extends APIEndpoint {
} elseif($state == Bridge::MAILPOET_KEY_EXPIRING) {
$success_message = sprintf(
__('Your MailPoet key expires on %s!', 'mailpoet'),
Carbon::createFromTimestamp(strtotime($result['data']['expire_at']))
->format($this->date_time->getDateFormat())
$this->date_time->formatDate(strtotime($result['data']['expire_at']))
);
}
@ -94,8 +92,7 @@ class Services extends APIEndpoint {
} elseif($state == Bridge::PREMIUM_KEY_EXPIRING) {
$success_message = sprintf(
__('Your license key expires on %s.', 'mailpoet'),
Carbon::createFromTimestamp(strtotime($result['data']['expire_at']))
->format($this->date_time->getDateFormat())
$this->date_time->formatDate(strtotime($result['data']['expire_at']))
);
}