Rename the constructor Ebook::__construct() to static Ebook::FromFilesystem()

Also added `GetFoo()` methods for all the derived properties like `GetUrl()`, `GetHasDownloads()`, etc. Removed that logic from the constructor so that it's reusable in `Ebook::FromFilesystem()` and `Ebook::GetByIdentifier()`
This commit is contained in:
Mike Colagrosso 2024-05-20 22:33:16 -06:00 committed by Alex Cabal
parent f605a4df60
commit 2098b265a8
9 changed files with 656 additions and 279 deletions

View file

@ -3,8 +3,10 @@ class EbookSource{
public EbookSourceType $Type;
public string $Url;
public function __construct(EbookSourceType $type, string $url){
$this->Type = $type;
$this->Url = $url;
public static function FromTypeAndUrl(EbookSourceType $type, string $url): EbookSource{
$instance = new EbookSource();
$instance->Type = $type;
$instance->Url = $url;
return $instance;
}
}