From 9cd4eab02e77fd15c2210ce89661904dbaa09afc Mon Sep 17 00:00:00 2001 From: Attila Fulop <1162360+fulopattila122@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:04:35 +0200 Subject: [PATCH] Added the Features::findByName() method --- src/Support/Features.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Support/Features.php b/src/Support/Features.php index 606142664..d98dfe7ef 100644 --- a/src/Support/Features.php +++ b/src/Support/Features.php @@ -14,6 +14,7 @@ namespace Vanilo\Support; +use Vanilo\Contracts\Feature; use Vanilo\Support\Features\MultiChannel; use Vanilo\Support\Features\Pricing; @@ -23,6 +24,15 @@ class Features private static ?Pricing $pricing = null; + public static function findByName(string $name): ?Feature + { + return match ($name) { + 'pricing' => self::pricing(), + 'multichannel' => self::multichannel(), + default => null, + }; + } + public static function multichannel(): MultiChannel { return self::$multiChannel ?: (self::$multiChannel = new MultiChannel());