class of a `Sharer`). */ final class Sharers { /** @return list the names of the platforms, as the routes and the database know them */ public function names(): array { return array_values(array_filter(array_keys((array) config('manager.sharing.platforms', [])), fn ($name) => is_string($name) && preg_match('/^[a-z][a-z0-9_]{0,19}$/', $name) === 1)); } public function has(string $name): bool { return in_array($name, $this->names(), true); } public function for(string $name): Sharer { $class = config("manager.sharing.platforms.{$name}"); abort_unless($this->has($name) && is_string($class) && is_subclass_of($class, Sharer::class), 404); return app($class); } /** The owner has connected this platform. */ public function isConnected(string $name): bool { return $this->has($name) && $this->for($name)->connection() !== null; } }