Skip to content

Commit 1a7a8ff

Browse files
committed
Add Config class implementing ArrayAccess
1 parent a01b3ee commit 1a7a8ff

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/Config.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Xhgui\Profiler;
4+
5+
use ArrayAccess;
6+
7+
class Config implements ArrayAccess
8+
{
9+
/** @var array */
10+
private $config;
11+
12+
public function __construct(array $config = array())
13+
{
14+
$this->config = $config;
15+
}
16+
17+
public function offsetExists($offset)
18+
{
19+
return isset($this->config[$offset]);
20+
}
21+
22+
public function offsetGet($offset)
23+
{
24+
return $this->config[$offset];
25+
}
26+
27+
public function offsetSet($offset, $value)
28+
{
29+
$this->config[$offset] = $value;
30+
}
31+
32+
public function offsetUnset($offset)
33+
{
34+
unset($this->config[$offset]);
35+
}
36+
}

0 commit comments

Comments
 (0)