Skip to content

Commit

Permalink
default dispatcher static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspijak committed Nov 13, 2023
1 parent 114c8c6 commit 9484b1c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Event/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

use BulkGate\Plugin\{Strict, Settings\Settings};
use function array_key_exists, in_array, str_replace, uniqid, preg_replace;
use function array_key_exists, in_array, str_replace, uniqid, preg_replace, is_array;

class Dispatcher
{
Expand All @@ -25,14 +25,15 @@ class Dispatcher

private Loader $loader;

public static string $default_dispatcher = self::Direct;

public function __construct(Settings $settings, Hook $hook, Loader $loader)
{
$this->settings = $settings;
$this->hook = $hook;
$this->loader = $loader;
}


/**
* @param array<array-key, mixed> $parameters
*/
Expand All @@ -42,7 +43,7 @@ public function dispatch(string $category, string $endpoint, Variables $variable

if ($this->check($category, $endpoint, $variables))
{
if (in_array($this->settings->load('main:dispatcher') ?? self::Direct, [self::Cron, self::Asset], true))
if (in_array($this->settings->load('main:dispatcher') ?? self::$default_dispatcher, [self::Cron, self::Asset], true))
{
$id = preg_replace('~[^0-9a-zA-Z]~', '-', uniqid('', true));

Expand Down

0 comments on commit 9484b1c

Please sign in to comment.