mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Changed logic to list domains to centralize conditions in service
This commit is contained in:
37
module/Core/src/Domain/Model/DomainItem.php
Normal file
37
module/Core/src/Domain/Model/DomainItem.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Domain\Model;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
final class DomainItem implements JsonSerializable
|
||||
{
|
||||
private string $domain;
|
||||
private bool $isDefault;
|
||||
|
||||
public function __construct(string $domain, bool $isDefault)
|
||||
{
|
||||
$this->domain = $domain;
|
||||
$this->isDefault = $isDefault;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'domain' => $this->domain,
|
||||
'isDefault' => $this->isDefault,
|
||||
];
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
public function isDefault(): bool
|
||||
{
|
||||
return $this->isDefault;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user