Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F211127
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/Engines/Templates/Smarty/Plugins/modifier.romanize.php b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
index 4fa5f0b..a9f00a1 100644
--- a/Engines/Templates/Smarty/Plugins/modifier.romanize.php
+++ b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
@@ -1,28 +1,34 @@
<?php
+declare(strict_types=1);
+
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifier
*/
use Keruald\OmniTools\Culture\Rome\RomanNumerals;
/**
* Smarty romanize modifier plugin
*
* Type: modifier<br>
* Name: romanize<br>
* Purpose: prints a number in roman
*
* @param int $
* @return string
*/
function smarty_modifier_romanize ($number) : string {
+ if (!is_numeric($number)) {
+ return (string)$number;
+ }
+
try {
- return RomanNumerals::fromHinduArabic($number);
- } catch (Throwable $ex) {
+ return RomanNumerals::fromHinduArabic((int)$number);
+ } catch (InvalidArgumentException $ex) {
// Not a strictly positive integer, don't modify
- return $number;
+ return (string)$number;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Nov 21, 13:58 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20891
Default Alt Text
(1 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment