ColumnsMetadata::getColumn()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\Metadata;
6
7
use ArrayObject;
8
use Soluble\Datatype\Column\Definition\AbstractColumnDefinition;
9
10
class ColumnsMetadata extends ArrayObject
11
{
12
    /**
13
     * Return specific column metadata.
14
     *
15
     * @throws Exception\UnexistentColumnException
16
     */
17 2
    public function getColumn(string $name): AbstractColumnDefinition
18
    {
19 2
        if (!$this->offsetExists($name)) {
20 2
            throw new Exception\UnexistentColumnException("Column '$name' does not exists in metadata");
21
        }
22
23 2
        return $this->offsetGet($name);
24
    }
25
}
26