This commit is contained in:
as2252258@163.com
2021-08-29 04:06:49 +08:00
parent 9da50baed0
commit 133ca2c273
21 changed files with 356 additions and 495 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ use Kiri\Events\EventProvider;
* @param string $name
* @param array $params
*/
public function __construct(public string $name, public array $params = [])
public function __construct(string $name, array $params = [])
{
}
@@ -32,13 +32,13 @@ use Kiri\Events\EventProvider;
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
public static function execute(mixed $params, mixed $class, mixed $method = null): bool
{
$pro = di(EventProvider::class);
if (is_string($class)) {
$class = di($class);
}
$pro->on($this->name, [$class, $method]);
$pro->on($params->name, [$class, $method]);
return true;
}