-
Notifications
You must be signed in to change notification settings - Fork 4
/
Features.php
65 lines (52 loc) · 1.41 KB
/
Features.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
declare(strict_types=1);
/**
* Contains the Features class.
*
* @copyright Copyright (c) 2023 Vanilo UG
* @author Attila Fulop
* @license MIT
* @since 2023-09-07
*
*/
namespace Vanilo\Support;
use Vanilo\Contracts\Feature;
use Vanilo\Support\Features\MultiChannel;
use Vanilo\Support\Features\Pricing;
class Features
{
private static ?MultiChannel $multiChannel = null;
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());
}
public static function pricing(): Pricing
{
return self::$pricing ?: (self::$pricing = new Pricing());
}
public static function isMultiChannelEnabled(): bool
{
return self::multichannel()->isEnabled();
}
public static function isMultiChannelDisabled(): bool
{
return self::multichannel()->isDisabled();
}
public static function isPricingEnabled(): bool
{
return self::pricing()->isEnabled();
}
public static function isPricingDisabled(): bool
{
return self::pricing()->isDisabled();
}
}