-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureToggleProviderInterface.php
More file actions
57 lines (49 loc) · 1.84 KB
/
FeatureToggleProviderInterface.php
File metadata and controls
57 lines (49 loc) · 1.84 KB
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
<?php
declare(strict_types=1);
namespace SonsOfPHP\Contract\FeatureToggle;
use SonsOfPHP\Contract\FeatureToggle\Exception\FeatureAlreadyExistsExceptionInterface;
use SonsOfPHP\Contract\FeatureToggle\Exception\FeatureNotFoundExceptionInterface;
use SonsOfPHP\Contract\FeatureToggle\Exception\InvalidArgumentExceptionInterface;
/**
* Feature Toggle Provider Interface.
*
* The provider's resposibile is to maintain the feature toggles. These feature
* toggles could be pulled from a database of a yaml file.
*
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface FeatureToggleProviderInterface
{
/**
* MUST support keys consisting of the characters A-Z, a-z, 0-9, _, and .
* in any order in UTF-8 encoding and a length of up to 64 characters
*/
//public function getFeatureToggleByKey(string $key): ?FeatureInterface;
/**
* @throws InvalidArgumentExceptionInterface
* When the $key is invalid. MUST support keys consisting of the
* characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding and
* a length of up to 64 characters
*
* @throws FeatureNotFoundExceptionInterface
* Thrown when the feature cannot be found
*/
public function get(string $key): FeatureInterface;
/**
* @throws InvalidArgumentExceptionInterface
* When the $key is invalid. MUST support keys consisting of the
* characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding and
* a length of up to 64 characters
*/
public function has(string $key): bool;
/**
* @throws FeatureAlreadyExistsExceptionInterface
*/
public function add(FeatureInterface $feature): void;
/**
* Should return iterable with the "key" being the feature's $key
*
* @return iterable<string, FeatureInterface>
*/
public function all(): iterable;
}