From 0764960606d56a9f0865ebb07671d30a7d232b6a Mon Sep 17 00:00:00 2001 From: mirzaev Date: Sun, 2 Feb 2025 18:04:25 +0700 Subject: [PATCH] created --- .gitignore | 1 + README.md | 20 +++++++++-- composer.json | 30 ++++++++++++++++ composer.lock | 20 +++++++++++ svoboda/time/system/statement.php | 58 +++++++++++++++++++++++++++++++ svoboda/time/tests/time.php | 34 ++++++++++++++++++ 6 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 svoboda/time/system/statement.php create mode 100644 svoboda/time/tests/time.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22d0d82 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/README.md b/README.md index f9b2531..19e716a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ -# time +# Time +Time since Svoboda was created
-Time since Svoboda was created \ No newline at end of file +## Dependencies +1. [PHP 8.4](https://www.php.net/releases/8.4/en.php) +2. [Composer](https://getcomposer.org/) (php package manager) + +## Installation +`composer require svoboda/time` + +## Example +```php + +``` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..94a2ff6 --- /dev/null +++ b/composer.json @@ -0,0 +1,30 @@ +{ + "name": "svoboda/time", + "description": "Time since Svoboda was created", + "homepage": "https://git.svoboda.works/svoboda/time", + "type": "library", + "readme": "README.md", + "license": "WTFPL", + "authors": [ + { + "name": "Arsen Mirzaev Tatyano-Muradovich", + "email": "arsen@mirzaev.sexy", + "homepage": "https://mirzaev.sexy", + "role": "Programmer" + } + ], + "require": { + "php": "^8.4" + }, + "autoload": { + "psr-4": { + "svoboda\\time\\": "svoboda/time/system" + } + }, + "autoload-dev": { + "psr-4": { + "svoboda\\time\\tests\\": "svoboda/time/tests" + } + } +} + diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..9601f39 --- /dev/null +++ b/composer.lock @@ -0,0 +1,20 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "747a4e9f0ccecc15e0c895de6ed5fed3", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^8.4" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/svoboda/time/system/statement.php b/svoboda/time/system/statement.php new file mode 100644 index 0000000..f94ab98 --- /dev/null +++ b/svoboda/time/system/statement.php @@ -0,0 +1,58 @@ + + */ +final class statement +{ + /** + * Statement + * + * @see https://en.wikipedia.org/wiki/Atom_(web_standard) ATOM + * @see https://www.php.net/manual/en/class.datetimeinterface.php#datetimeinterface.constants.atom DateTime ATOM + * + * @var string $statement Time of the statement of Svoboda creation was publishedsda + */ + protected static string $statement = '2024-06-01T20:15:25+00:00'; + + /** + * Datetime + * + * @return datetime DateTime implementator for the statement publishment time + */ + public static function datetime(): datetime + { + // Exit (success) + return datetime::createFromFormat(datetime::ATOM, static::$statement); + } + + /** + * Timestamp + * + * @return int Seconds that passed from the statement was publishment + */ + public static function timestamp(): int + { + // Exit (success) + return new datetime()->getTimestamp() - static::datetime()->getTimestamp(); + } +} diff --git a/svoboda/time/tests/time.php b/svoboda/time/tests/time.php new file mode 100644 index 0000000..ee50a43 --- /dev/null +++ b/svoboda/time/tests/time.php @@ -0,0 +1,34 @@ +