Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
9 / 9 |
| Configuration | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
5 | |
100.00% |
9 / 9 |
| set($key, $value) | |
100.00% |
1 / 1 |
3 | |
100.00% |
5 / 5 |
|||
| get($key) | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
| <?php | |
| namespace Tdd; | |
| class Configuration | |
| { | |
| private $data = array(); | |
| public function set($key, $value) | |
| { | |
| if (!is_string($key) || empty($key)) | |
| { | |
| throw new \InvalidArgumentException('Key must be a non-empty string!'); | |
| } | |
| $this->data[$key] = $value; | |
| } | |
| public function get($key) | |
| { | |
| return | |
| isset($this->data[$key]) | |
| ? $this->data[$key] | |
| : null | |
| ; | |
| } | |
| } |