path().'/'.$path; } /** * Get module */ function module(string $moduleName): ModuleContract { return modular()->module($moduleName); } /** * Modules * * @return Collection */ function modules(bool $withDisabled = false): Collection { return $withDisabled ? modular()->allModules() : modular()->modules(); } /** * Empty module */ function emptyModule(): ModuleContract { return modular()->emptyModule(); } /** * Module exists */ function module_exists(string $moduleName): bool { return modular()->moduleExists($moduleName); } /** * Create an anonymous class that acts as a dynamic object. * * @param mixed ...$arguments Key-value pairs passed as an associative array. * @return object Anonymous class instance with dynamic properties. */ function emptyClass(...$arguments): object { /** * @var array $arguments */ return new class($arguments) { /** * Internal data storage. * * @var array */ private array $data = []; /** * Constructor that sets properties. * * @param array $props */ public function __construct(array $props) { foreach ($props as $key => $value) { $this->data[$key] = $value; } } /** * Magic getter. * * @return mixed|null */ public function __get(string $key): mixed { return $this->data[$key] ?? null; } /** * Magic setter. */ public function __set(string $key, mixed $value): void { $this->data[$key] = $value; } /** * Magic isset. */ public function __isset(string $key): bool { return isset($this->data[$key]); } }; }