mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Migrated AppOptions to immutable object
This commit is contained in:
@@ -21,7 +21,7 @@ return [
|
||||
ErrorHandler\NotFoundRedirectHandler::class => ConfigAbstractFactory::class,
|
||||
ErrorHandler\NotFoundTemplateHandler::class => InvokableFactory::class,
|
||||
|
||||
Options\AppOptions::class => ConfigAbstractFactory::class,
|
||||
Options\AppOptions::class => [ValinorConfigFactory::class, 'config.app_options'],
|
||||
Options\DeleteShortUrlsOptions::class => ConfigAbstractFactory::class,
|
||||
Options\NotFoundRedirectOptions::class => ConfigAbstractFactory::class,
|
||||
Options\RedirectOptions::class => ConfigAbstractFactory::class,
|
||||
@@ -86,7 +86,6 @@ return [
|
||||
Domain\DomainService::class,
|
||||
],
|
||||
|
||||
Options\AppOptions::class => ['config.app_options'],
|
||||
Options\DeleteShortUrlsOptions::class => ['config.delete_short_urls'],
|
||||
Options\NotFoundRedirectOptions::class => ['config.not_found_redirects'],
|
||||
Options\RedirectOptions::class => ['config.redirects'],
|
||||
|
||||
@@ -4,35 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Options;
|
||||
|
||||
use Laminas\Stdlib\AbstractOptions;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class AppOptions extends AbstractOptions
|
||||
final class AppOptions
|
||||
{
|
||||
private string $name = 'Shlink';
|
||||
private string $version = '3.0.0';
|
||||
|
||||
public function getName(): string
|
||||
public function __construct(public string $name = 'Shlink', public string $version = '3.0.0')
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
protected function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
protected function setVersion(string $version): self
|
||||
{
|
||||
$this->version = $version;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
|
||||
@@ -165,7 +165,7 @@ class NotifyVisitToWebHooksTest extends TestCase
|
||||
['webhooks' => $webhooks, 'notify_orphan_visits_to_webhooks' => $notifyOrphanVisits],
|
||||
),
|
||||
new ShortUrlDataTransformer(new ShortUrlStringifier([])),
|
||||
new AppOptions(['name' => 'Shlink', 'version' => '1.2.3']),
|
||||
new AppOptions('Shlink', '1.2.3'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user