forked from DZunke/FeatureFlagsBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Context.php
52 lines (42 loc) · 796 Bytes
/
Context.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
<?php
namespace DZunke\FeatureFlagsBundle;
class Context
{
/**
* @var array
*/
private $context = [];
/**
* @param string $name
* @param mixed $value
* @return $this
*/
public function set($name, $value): self
{
$this->context[(string)$name] = $value;
return $this;
}
/**
* @param string $name
* @return null
*/
public function get($name)
{
return isset($this->context[(string)$name]) ? $this->context[(string)$name] : null;
}
/**
* @return array
*/
public function all(): array
{
return $this->context;
}
/**
* @return $this
*/
public function clear(): self
{
$this->context = [];
return $this;
}
}