Completed
Pull Request — master (#98)
by Greg
02:12
created

AnnotationData   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 2
A getList() 0 4 2
A has() 0 4 1
A keys() 0 4 1
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