your mama

This commit is contained in:
2025-10-22 01:39:10 +07:00
parent 582ac66e03
commit c4d318ce63
3 changed files with 108 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
vendor

36
composer.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "mirzaev/currencies",
"description": "Library for easy currencies support",
"homepage": "https://git.svoboda.works/mirzaev/currencies",
"type": "library",
"keywords": [
"currencies"
],
"readme": "README.md",
"license": "WTFPL",
"authors": [
{
"name": "Arsen Mirzaev Tatyano-Muradovich",
"email": "arsen@mirzaev.sexy",
"homepage": "https://mirzaev.sexy",
"role": "Creator"
}
],
"support": {
"issues": "https://git.svoboda.works/mirzaev/currencies/issues"
},
"require": {
"php": "^8.4",
"mirzaev/languages": "^1.0"
},
"autoload": {
"psr-4": {
"mirzaev\\currencies\\": "mirzaev/currencies/system"
}
},
"autoload-dev": {
"psr-4": {
"mirzaev\\currencies\\tests\\": "mirzaev/currencies/tests"
}
}
}

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace mirzaev\currencies;
// Library for languages
use mirzaev\languages\language;
/**
* Types of currencies by ISO 4217 standart
*
* @package mirzaev\currencies
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
enum currency
{
case usd;
case rub;
/**
* Label
*
* Initialize label of the currency
*
* @param language|null $language Language into which to translate
*
* @return string Translated label of the currency
*
* @todo
* 1. More currencies
* 2. suck my bolls
* 3. Cases???
*/
public function label(?language $language = language::en): string
{
// Exit (success)
return match ($this) {
currency::usd => match ($language) {
language::en => 'Dollar',
language::ru => 'Доллар'
},
currency::rub => match ($language) {
language::en => 'Ruble',
language::ru => 'Рубль'
}
};
}
/**
* Symbol
*
* Initialize symbol of the currency
*
* @return string Symbol of the currency
*
* @todo
* 1. More currencies
*/
public function symbol(): string
{
// Exit (success)
return match ($this) {
currency::usd => '$',
currency::rub => '₽'
};
}
}