custom/plugins/NetzpShopmanager6/src/Core/Content/Flow/Dispatching/Action/MobilePushAction.php line 36

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace NetzpShopmanager6\Core\Content\Flow\Dispatching\Action;
  3. use NetzpShopmanager6\Core\Framework\Event\MobilePushAware;
  4. use Shopware\Core\Content\Flow\Dispatching\Action\FlowAction;
  5. use Shopware\Core\Framework\Event\FlowEvent;
  6. use NetzpShopmanager6\Components\PushMessageHelper;
  7. class MobilePushAction extends FlowAction
  8. {
  9.     private $pushHelper;
  10.     public function __construct(PushMessageHelper $pushHelper)
  11.     {
  12.         $this->pushHelper $pushHelper;
  13.     }
  14.     public static function getName(): string
  15.     {
  16.         return 'action.netzp.mobilepush';
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             self::getName() => 'handle',
  22.         ];
  23.     }
  24.     public function requirements(): array
  25.     {
  26.         return [MobilePushAware::class];
  27.     }
  28.     public function handle(FlowEvent $event): void
  29.     {
  30.         $config $event->getConfig();
  31.         if ( ! \array_key_exists('template'$config)) {
  32.             return;
  33.         }
  34.         $template $config['template'];
  35.         if (empty($template)) {
  36.             return;
  37.         }
  38.         try {
  39.             $this->pushHelper->handlePushMessageForFlowBuilderEvent($event->getEvent(), $event->getContext(), $template);
  40.         }
  41.         catch (\Exception $ex) {
  42.             //
  43.         }
  44.     }
  45. }