1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 00:14:05 +00:00

Merge branch 'telescope-tags' of github.com:stancl/tenancy into telescope-tags

This commit is contained in:
Samuel Štancl 2019-08-19 20:59:11 +02:00
commit 886123ce62

View file

@ -99,7 +99,7 @@ trait TenantManagerEvents
*/ */
public function integrationEvent(string $name, callable $callback) public function integrationEvent(string $name, callable $callback)
{ {
if (array_key_exists($name, $this->integrationListeners)) { if (\array_key_exists($name, $this->integrationListeners)) {
$this->integrationListeners[$name][] = $callback; $this->integrationListeners[$name][] = $callback;
} else { } else {
$this->integrationListeners[$name] = [$callback]; $this->integrationListeners[$name] = [$callback];
@ -117,10 +117,10 @@ trait TenantManagerEvents
{ {
if ($arguments) { if ($arguments) {
// If $arguments are supplied, execute all listeners with arguments. // If $arguments are supplied, execute all listeners with arguments.
return array_reduce($this->integrationListeners[$name] ?? [], function ($tags, $listener) use ($arguments) { return \array_reduce($this->integrationListeners[$name] ?? [], function ($tags, $listener) use ($arguments) {
return array_merge($tags, $listener(...$arguments)); return \array_merge($tags, $listener(...$arguments));
}, []); }, []);
}; }
return $this->integrationListeners[$name]; return $this->integrationListeners[$name];
} }