| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | abstract class AbstractCommandOption implements CommandOptionInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | protected $options = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param $key |
||
| 20 | * @param $value |
||
| 21 | */ |
||
| 22 | public function add($key, $value) |
||
| 23 | { |
||
| 24 | $this->options[$key] = $value; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param $key |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function get($key) |
||
| 32 | { |
||
| 33 | if (!array_key_exists($key, $this->options)) { |
||
| 34 | throw new InvalidArgumentException( |
||
| 35 | sprintf('Key %s is not valid, available options are: %s', |
||
| 36 | $key, |
||
| 37 | implode(',', array_keys($this->options) |
||
| 38 | ) |
||
| 39 | ) |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->options[$key]; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | public function all() |
||
| 52 | } |
||
| 53 | } |
||
| 54 |