# fluent-cart/1.6.4/app/Events/EventDispatcher.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 59 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Events/EventDispatcher.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Events/EventDispatcher.php
- Modified: 2025-10-14T16:36:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Events/EventDispatcher.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Events;

use FluentCart\App\Listeners\Activity;
use FluentCart\Framework\Support\ArrayableInterface;

abstract class EventDispatcher implements ArrayableInterface
{
    protected array $listeners = [];
    public string $hook = '';
    public bool $autoFireHook = true;


    public function dispatch()
    {
        $this->beforeDispatch();
        $iterableListeners = $this->listeners;
        $iterableListeners[] = Activity::class;

        foreach ($iterableListeners as $listener) {
            $listener::handle($this);
        }

        $this->afterDispatch();

        if (!empty($this->hook) && $this->autoFireHook) {
            do_action($this->hook, $this->toArray());
        }
    }

    public function shouldCreateActivity(): bool
    {
        return true;
    }

    public function getEventInfoForActivity(): array
    {
        return [];
    }


    /**
     * @return mixed
     */
    abstract public function getActivityEventModel();

    public function beforeDispatch()
    {

    }

    public function afterDispatch()
    {

    }

}

```
