From 0dfdb4fc0ea6855a412a4458c9af3c2e489f68e1 Mon Sep 17 00:00:00 2001 From: Akex Date: Thu, 11 Apr 2024 18:33:02 +0500 Subject: [PATCH] add func countind days to NY --- public/public/Actions/HowDaysToNYAction.php | 20 ++++++++++++++++++++ public/public/index.php | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 public/public/Actions/HowDaysToNYAction.php diff --git a/public/public/Actions/HowDaysToNYAction.php b/public/public/Actions/HowDaysToNYAction.php new file mode 100644 index 0000000..9d71a5a --- /dev/null +++ b/public/public/Actions/HowDaysToNYAction.php @@ -0,0 +1,20 @@ +modify('first day of Jan +1 year'); + + return (int) $dateOfNY->diff($date)->format('%a'); + } +} \ No newline at end of file diff --git a/public/public/index.php b/public/public/index.php index 8342e1d..bfc63ce 100644 --- a/public/public/index.php +++ b/public/public/index.php @@ -2,6 +2,7 @@ require_once __DIR__ . '/../vendor/autoload.php'; -use App\Actions /*placeholder for a class */; +use App\Actions\HowDaysToNYAction; use App\TestData\TestData; +echo "Дней до нового года (в днях): ". HowDaysToNYAction::count(new DateTimeImmutable()); \ No newline at end of file -- GitLab