Completed
Pull Request — master (#174)
by
unknown
01:45
created

AnnotationData::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
namespace Consolidation\AnnotatedCommand;
3
4
use Consolidation\AnnotatedCommand\Parser\Internal\CsvUtils;
5
6
class AnnotationData extends \ArrayObject
7
{
8
    public function get($key, $default = '')
9
    {
10
        return $this->has($key) ? CsvUtils::toString($this[$key]) : $default;
11
    }
12
13
    public function getList($key, $default = [])
14
    {
15
        return $this->has($key) ? CsvUtils::toList($this[$key]) : $default;
16
    }
17
18
    public function has($key)
19
    {
20
        return isset($this[$key]);
21
    }
22
23
    public function keys()
24
    {
25
        return array_keys($this->getArrayCopy());
26
    }
27
28
    public function set($key, $default = '')
29
    {
30
        $this->{$key} = $default;
31
        return $this;
32
    }
33
}
34