diff --git a/src/Features/TelescopeTags.php b/src/Features/TelescopeTags.php index ecafacb2..26f3e345 100644 --- a/src/Features/TelescopeTags.php +++ b/src/Features/TelescopeTags.php @@ -39,8 +39,7 @@ class TelescopeTags implements FeatureProvider return ($this->callback)($entry); } - // todo name? - public function tagUsing(callable $callback) + public function setCallback(callable $callback) { $this->callback = $callback; } diff --git a/src/Tenant.php b/src/Tenant.php index f32539e2..7bc65120 100644 --- a/src/Tenant.php +++ b/src/Tenant.php @@ -7,8 +7,6 @@ namespace Stancl\Tenancy; use ArrayAccess; use Stancl\Tenancy\Contracts\StorageDriver; -// todo tenant storage - /** * @internal Class is subject to breaking changes in minor and patch versions. */ diff --git a/src/TenantManagerv2.php b/src/TenantManagerv2.php index a1bcf3ab..c49e451d 100644 --- a/src/TenantManagerv2.php +++ b/src/TenantManagerv2.php @@ -34,9 +34,8 @@ class TenantManagerv2 /** @var DatabaseManager */ protected $database; - // todo event "listeners" instead of "callbacks" /** @var callable[][] */ - protected $callbacks = []; + protected $listeners = []; public function __construct(Application $app, ConsoleKernel $artisan, Contracts\StorageDriver $storage, DatabaseManager $database) { @@ -241,30 +240,30 @@ class TenantManagerv2 } /** - * Add an event callback. + * Add an event listener. * * @param string $name - * @param callable $callback + * @param callable $listener * @return self */ - public function eventCallback(string $name, callable $callback): self + public function eventListener(string $name, callable $listener): self { - $this->eventCallbacks[$name] = $this->eventCallbacks[$name] ?? []; - $this->eventCallbacks[$name][] = $callback; + $this->eventListeners[$name] = $this->eventListeners[$name] ?? []; + $this->eventListeners[$name][] = $listener; return $this; } /** - * Execute event callbacks. + * Execute event listeners. * * @param string $name * @return string[] */ protected function event(string $name): array { - return array_reduce($this->eventCalbacks[$name] ?? [], function ($prevented, $callback) { - $prevented = array_merge($prevented, $callback($this) ?? []); + return array_reduce($this->eventCalbacks[$name] ?? [], function ($prevented, $listener) { + $prevented = array_merge($prevented, $listener($this) ?? []); return $prevented; }, []);