mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 18:42:00 -04:00
Add PropertyFromHttp trait and update codebase to use new pattern
This commit is contained in:
parent
c35c47b793
commit
acb30b897c
47 changed files with 851 additions and 527 deletions
|
@ -1,11 +1,8 @@
|
|||
<?
|
||||
|
||||
use Safe\DateTimeImmutable;
|
||||
|
||||
use function Safe\preg_match;
|
||||
|
||||
class Contributor{
|
||||
public ?int $EbookId = null;
|
||||
public int $EbookId;
|
||||
public string $Name;
|
||||
public string $UrlName;
|
||||
public ?string $SortName = null;
|
||||
|
@ -13,19 +10,11 @@ class Contributor{
|
|||
public ?string $MarcRole = null;
|
||||
public ?string $FullName = null;
|
||||
public ?string $NacoafUrl = null;
|
||||
public ?int $SortOrder = null;
|
||||
public int $SortOrder;
|
||||
|
||||
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;
|
||||
}
|
||||
// *******
|
||||
// METHODS
|
||||
// *******
|
||||
|
||||
/**
|
||||
* @throws Exceptions\ValidationException
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue