mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Migrated NotFoundRedirectOptions to immutable object
This commit is contained in:
@@ -4,14 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Options;
|
||||
|
||||
use Laminas\Stdlib\AbstractOptions;
|
||||
use Shlinkio\Shlink\Core\Config\NotFoundRedirectConfigInterface;
|
||||
|
||||
class NotFoundRedirectOptions extends AbstractOptions implements NotFoundRedirectConfigInterface
|
||||
final class NotFoundRedirectOptions implements NotFoundRedirectConfigInterface
|
||||
{
|
||||
private ?string $invalidShortUrl = null;
|
||||
private ?string $regular404 = null;
|
||||
private ?string $baseUrl = null;
|
||||
public function __construct(
|
||||
public readonly ?string $invalidShortUrl = null,
|
||||
public readonly ?string $regular404 = null,
|
||||
public readonly ?string $baseUrl = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function invalidShortUrlRedirect(): ?string
|
||||
{
|
||||
@@ -23,12 +25,6 @@ class NotFoundRedirectOptions extends AbstractOptions implements NotFoundRedirec
|
||||
return $this->invalidShortUrl !== null;
|
||||
}
|
||||
|
||||
protected function setInvalidShortUrl(?string $invalidShortUrl): self
|
||||
{
|
||||
$this->invalidShortUrl = $invalidShortUrl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function regular404Redirect(): ?string
|
||||
{
|
||||
return $this->regular404;
|
||||
@@ -39,12 +35,6 @@ class NotFoundRedirectOptions extends AbstractOptions implements NotFoundRedirec
|
||||
return $this->regular404 !== null;
|
||||
}
|
||||
|
||||
protected function setRegular404(?string $regular404): self
|
||||
{
|
||||
$this->regular404 = $regular404;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function baseUrlRedirect(): ?string
|
||||
{
|
||||
return $this->baseUrl;
|
||||
@@ -54,10 +44,4 @@ class NotFoundRedirectOptions extends AbstractOptions implements NotFoundRedirec
|
||||
{
|
||||
return $this->baseUrl !== null;
|
||||
}
|
||||
|
||||
protected function setBaseUrl(?string $baseUrl): self
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user