mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
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:
parent
f605a4df60
commit
2098b265a8
9 changed files with 656 additions and 279 deletions
|
@ -8,13 +8,15 @@ class Contributor{
|
|||
public ?string $FullName = null;
|
||||
public ?string $NacoafUrl = null;
|
||||
|
||||
public function __construct(string $name, string $sortName = null, string $fullName = null, string $wikipediaUrl = null, string $marcRole = null, string $nacoafUrl = null){
|
||||
$this->Name = str_replace('\'', '’', $name);
|
||||
$this->UrlName = Formatter::MakeUrlSafe($name);
|
||||
$this->SortName = $sortName;
|
||||
$this->FullName = $fullName;
|
||||
$this->WikipediaUrl = $wikipediaUrl;
|
||||
$this->MarcRole = $marcRole;
|
||||
$this->NacoafUrl = $nacoafUrl;
|
||||
public static function FromProperties(string $name, string $sortName = null, string $fullName = null, string $wikipediaUrl = null, string $marcRole = null, string $nacoafUrl = null): Contributor{
|
||||
$instance = new Contributor();
|
||||
$instance->Name = str_replace('\'', '’', $name);
|
||||
$instance->UrlName = Formatter::MakeUrlSafe($name);
|
||||
$instance->SortName = $sortName;
|
||||
$instance->FullName = $fullName;
|
||||
$instance->WikipediaUrl = $wikipediaUrl;
|
||||
$instance->MarcRole = $marcRole;
|
||||
$instance->NacoafUrl = $nacoafUrl;
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue