. */ declare(strict_types=1); namespace FireflyIII\Support\Twig; use FireflyIII\Models\PiggyBank as PB; use Twig_Extension; use Twig_SimpleFunction; /** * Class PiggyBank. */ class PiggyBank extends Twig_Extension { /** * */ public function getFunctions(): array { $functions = []; $functions[] = new Twig_SimpleFunction( 'currentRelevantRepAmount', function (PB $piggyBank) { return $piggyBank->currentRelevantRep()->currentamount; } ); $functions[] = new Twig_SimpleFunction( 'suggestedMonthlyAmount', function (PB $piggyBank) { return $piggyBank->getSuggestedMonthlyAmount(); } ); return $functions; } /** * Returns the name of the extension. * * @return string The extension name */ public function getName(): string { return 'FireflyIII\Support\Twig\PiggyBank'; } }