-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContextInterface.php
More file actions
43 lines (36 loc) · 1.11 KB
/
Copy pathContextInterface.php
File metadata and controls
43 lines (36 loc) · 1.11 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
<?php
declare(strict_types=1);
namespace SonsOfPHP\Contract\FeatureToggle;
use InvalidArgumentException;
/**
* Context is used to pass additional paramters to a toggle
*
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface ContextInterface // extends \ArrayAccess, \IteratorAggregate, \JsonSerializable
{
/**
* Get Context Parameters
*
* If the key does not exist, the $default should be returned
*
* @throws InvalidArgumentException if key or default is invalid
*/
public function get(string $key, mixed $default = null);
/**
* @throws InvalidArgumentException if key or value is invalid
*/
public function set(string $key, mixed $value): self;
/**
* If Context is a value object, with should be used instead.
*
* If key and value are the same, no need to clone, just return the same
* object as nothing has changed
*
* @throws \InvalidArgumentException if key or value is invalid
*/
//public function with(array|string $key, mixed $value = null): static;
/**
*/
public function has(string $key): bool;
}