This commit is contained in:
2021-08-03 18:20:44 +08:00
parent 5b28c52a10
commit 157795fad4
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ use Snowflake\Event as SEvent;
public function execute(mixed $class, mixed $method = null): bool
{
// TODO: Implement execute() method.
SEvent::on($this->name, [$class, $method], $this->params);
SEvent::on($this->name, [$class, $method]);
return true;
}
+5 -5
View File
@@ -197,22 +197,22 @@ abstract class BaseApplication extends Service
private function addEvent($key, $value): void
{
if ($value instanceof \Closure) {
Event::on($key, $value, [], true);
Event::on($key, $value, true);
return;
}
if (is_object($value)) {
Event::on($key, $value, [], true);
Event::on($key, $value, true);
return;
}
if (is_array($value)) {
if (is_object($value[0]) && !($value[0] instanceof \Closure)) {
Event::on($key, $value, [], true);
Event::on($key, $value, true);
return;
}
if (is_string($value[0])) {
$value[0] = Snowflake::createObject($value[0]);
Event::on($key, $value, [], true);
Event::on($key, $value, true);
return;
}
@@ -220,7 +220,7 @@ abstract class BaseApplication extends Service
if (!is_callable($item, true)) {
throw new InitException("Class does not hav callback.");
}
Event::on($key, $item, [], true);
Event::on($key, $item, true);
}
}