src/Twig/BankExtension.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Twig;
  3. use App\Services\Core\Bank;
  4. use App\Tools\Core\StatusBankTool;
  5. use Twig\Extension\AbstractExtension;
  6. use Twig\TwigFunction;
  7. use Twig\TwigFilter;
  8. class BankExtension extends AbstractExtension
  9. {
  10.     public function __construct(Bank $bank)
  11.     {
  12.         $this->bank $bank;
  13.     }
  14.     public function getFunctions(): array
  15.     {
  16.         return [
  17.             new  TwigFunction('getStatusBank', [$this'getStatusBank']),
  18.             new  TwigFunction('getOrderPayment', [$this'getOrderPayment']),
  19.             new  TwigFunction('getUserOrderPayment', [$this'getUserOrderPayment']),
  20.         ];
  21.     }
  22.     public function getUserOrderPayment($paymentID)
  23.     {
  24.         return $this->bank->getUserOrderPayment($paymentID);
  25.     }
  26.     public function getOrderPayment($paymentID)
  27.     {
  28.         return $this->bank->getOrderPayment($paymentID);
  29.     }
  30.     public function getStatusBank($status)
  31.     {
  32.         return StatusBankTool::getStatus($status);
  33.     }
  34. }