mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 01:33:11 +08:00
Defined new options for new redirect configuration
This commit is contained in:
65
module/Core/src/Options/NotFoundRedirectOptions.php
Normal file
65
module/Core/src/Options/NotFoundRedirectOptions.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Options;
|
||||
|
||||
use Zend\Stdlib\AbstractOptions;
|
||||
|
||||
class NotFoundRedirectOptions extends AbstractOptions
|
||||
{
|
||||
/** @var string|null */
|
||||
private $invalidShortUrl;
|
||||
/** @var string|null */
|
||||
private $regular404;
|
||||
/** @var string|null */
|
||||
private $baseUrl;
|
||||
|
||||
public function getInvalidShortUrlRedirect(): ?string
|
||||
{
|
||||
return $this->invalidShortUrl;
|
||||
}
|
||||
|
||||
public function hasInvalidShortUrlRedirect(): bool
|
||||
{
|
||||
return $this->invalidShortUrl !== null;
|
||||
}
|
||||
|
||||
protected function setInvalidShortUrl(?string $invalidShortUrl): self
|
||||
{
|
||||
$this->invalidShortUrl = $invalidShortUrl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRegular404Redirect(): ?string
|
||||
{
|
||||
return $this->regular404;
|
||||
}
|
||||
|
||||
public function hasRegular404Redirect(): bool
|
||||
{
|
||||
return $this->regular404 !== null;
|
||||
}
|
||||
|
||||
protected function setRegular404(?string $regular404): self
|
||||
{
|
||||
$this->regular404 = $regular404;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBaseUrlRedirect(): ?string
|
||||
{
|
||||
return $this->baseUrl;
|
||||
}
|
||||
|
||||
public function hasBaseUrlRedirect(): bool
|
||||
{
|
||||
return $this->baseUrl !== null;
|
||||
}
|
||||
|
||||
protected function setBaseUrl(?string $baseUrl): self
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Options;
|
||||
|
||||
use Zend\Stdlib\AbstractOptions;
|
||||
|
||||
class NotFoundShortUrlOptions extends AbstractOptions
|
||||
{
|
||||
/** @var bool */
|
||||
private $enableRedirection = false;
|
||||
/** @var string|null */
|
||||
private $redirectTo;
|
||||
|
||||
public function isRedirectionEnabled(): bool
|
||||
{
|
||||
return $this->enableRedirection;
|
||||
}
|
||||
|
||||
protected function setEnableRedirection(bool $enableRedirection = true): self
|
||||
{
|
||||
$this->enableRedirection = $enableRedirection;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRedirectTo(): string
|
||||
{
|
||||
return $this->redirectTo ?? '';
|
||||
}
|
||||
|
||||
protected function setRedirectTo(?string $redirectTo): self
|
||||
{
|
||||
$this->redirectTo = $redirectTo;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user