mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 15:20:32 -04:00
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()`
22 lines
792 B
PHP
22 lines
792 B
PHP
<?
|
||
class Contributor{
|
||
public string $Name;
|
||
public string $UrlName;
|
||
public ?string $SortName = null;
|
||
public ?string $WikipediaUrl = null;
|
||
public ?string $MarcRole = null;
|
||
public ?string $FullName = null;
|
||
public ?string $NacoafUrl = null;
|
||
|
||
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;
|
||
}
|
||
}
|