. */ namespace SP\Core\UI; use Directory; use SP\Domain\Core\UI\ThemeContextInterface; use SP\Infrastructure\File\FileSystem; /** * Class ThemeContext */ final class ThemeContext implements ThemeContextInterface { private string $fullPath; private string $path; private string $viewsPath; private string $uri; public function __construct( string $basePath, string $baseUri, private readonly string $module, private readonly string $name ) { $this->fullPath = FileSystem::buildPath($basePath, $name); $this->path = FileSystem::buildPath(str_replace(APP_ROOT, '', $basePath), $name); $this->viewsPath = FileSystem::buildPath($this->fullPath, 'views'); $this->uri = sprintf( '%s/app/modules/%s/themes/%s', $baseUri, $module, $name ); } public function getModule(): string { return $this->module; } public function getName(): string { return $this->name; } public function getFullPath(): string { return $this->fullPath; } public function getPath(): string { return $this->path; } public function getViewsPath(): string { return $this->viewsPath; } public function getViewsDirectory(): Directory { return dir($this->viewsPath); } public function getUri(): string { return $this->uri; } }