1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 13:16:45 +02:00

feat(shortcodes): use new expression service for calc shortcode

This commit is contained in:
Awilum
2022-05-26 23:21:16 +03:00
parent 37fd79e816
commit 4001e04a67

View File

@@ -17,8 +17,8 @@ declare(strict_types=1);
namespace Flextype\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
use ChrisKonnertz\StringCalc\StringCalc;
use function registry;
use function expression;
// Shortcode: calc
// Usage: (calc:2+2)
@@ -27,5 +27,5 @@ parsers()->shortcodes()->addHandler('calc', static function (ShortcodeInterface
return '';
}
return (new StringCalc())->calculate(parsers()->shortcodes()->parse($s->getBBCode()));
return expression()->evaluate(parsers()->shortcodes()->parse($s->getBBCode()));
});