1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

harmonise namespace

This commit is contained in:
Daniel Waxweiler
2023-05-07 22:19:47 +02:00
parent 04767d4411
commit 0a8c4bedbf
9 changed files with 31 additions and 4 deletions

View File

@@ -1,4 +1,10 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly.
if (!defined('ABSPATH')) {
exit;
}
final class DateTimeWrapper { final class DateTimeWrapper {
private $dateTime; private $dateTime;
@@ -12,13 +18,13 @@ final class DateTimeWrapper {
if (!$timeZone) { if (!$timeZone) {
$timeZone = 'utc'; $timeZone = 'utc';
} }
$this->dateTime = new DateTime($text); $this->dateTime = new \DateTime($text);
$this->locale = $locale; $this->locale = $locale;
$this->timeZone = new DateTimeZone($timeZone); $this->timeZone = new \DateTimeZone($timeZone);
} }
public function getShortDate(): string { public function getShortDate(): string {
$formatter = IntlDateFormatter::create($this->locale, IntlDateFormatter::SHORT, IntlDateFormatter::NONE, $this->timeZone); $formatter = \IntlDateFormatter::create($this->locale, \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE, $this->timeZone);
return $formatter->format($this->dateTime); return $formatter->format($this->dateTime);
} }
@@ -27,7 +33,7 @@ final class DateTimeWrapper {
} }
public function get24Time(): string { public function get24Time(): string {
$formatter = IntlDateFormatter::create($this->locale, IntlDateFormatter::NONE, IntlDateFormatter::SHORT, $this->timeZone); $formatter = \IntlDateFormatter::create($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, $this->timeZone);
return $formatter->format($this->dateTime); return $formatter->format($this->dateTime);
} }
} }

View File

@@ -1,4 +1,11 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly.
if (!defined('ABSPATH')) {
exit;
}
final class Formatter final class Formatter
{ {
public static function format_date(string $locale, string $timeZone, string $start, ?string $end, bool $isShortOffsetNameShown): string { public static function format_date(string $locale, string $timeZone, string $start, ?string $end, bool $isShortOffsetNameShown): string {

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;

View File

@@ -1,4 +1,6 @@
<?php <?php
namespace MobilizonConnector;
// Exit if this file is called directly. // Exit if this file is called directly.
if (!defined('ABSPATH')) { if (!defined('ABSPATH')) {
exit; exit;