Skip to content

Commit 9484b1c

Browse files
committed
default dispatcher static variable
1 parent 114c8c6 commit 9484b1c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/Event/Dispatcher.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
use BulkGate\Plugin\{Strict, Settings\Settings};
11-
use function array_key_exists, in_array, str_replace, uniqid, preg_replace;
11+
use function array_key_exists, in_array, str_replace, uniqid, preg_replace, is_array;
1212

1313
class Dispatcher
1414
{
@@ -25,14 +25,15 @@ class Dispatcher
2525

2626
private Loader $loader;
2727

28+
public static string $default_dispatcher = self::Direct;
29+
2830
public function __construct(Settings $settings, Hook $hook, Loader $loader)
2931
{
3032
$this->settings = $settings;
3133
$this->hook = $hook;
3234
$this->loader = $loader;
3335
}
3436

35-
3637
/**
3738
* @param array<array-key, mixed> $parameters
3839
*/
@@ -42,7 +43,7 @@ public function dispatch(string $category, string $endpoint, Variables $variable
4243

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

0 commit comments

Comments
 (0)