-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extensions): add
Math
extension
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Flextype - Hybrid Content Management System with the freedom of a headless CMS | ||
* and with the full functionality of a traditional CMS! | ||
* | ||
* Copyright (c) Sergey Romanenko (https://awilum.github.io) | ||
* | ||
* Licensed under The MIT License. | ||
* | ||
* For full copyright and license information, please see the LICENSE | ||
* Redistributions of files must retain the above copyright notice. | ||
*/ | ||
|
||
namespace Flextype\Plugin\Twig\Extension; | ||
|
||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
class MathTwigExtension extends AbstractExtension | ||
{ | ||
/** | ||
* Callback for twig. | ||
* | ||
* @return array | ||
*/ | ||
public function getFunctions() : array | ||
{ | ||
return [ | ||
new TwigFunction('ceil', '\ceil'), | ||
new TwigFunction('floor', '\floor'), | ||
new TwigFunction('min', '\min'), | ||
new TwigFunction('max', '\max') | ||
]; | ||
} | ||
} |