ParserFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 2
1
<?php
2
3
namespace Amock\Parser;
4
5
class ParserFactory
6
{
7
    const TYPE_YAML = 'yaml';
8
9 10
    public static function create(string $type): Parser
10
    {
11
        switch ($type) {
12 10
            case static::TYPE_YAML:
13 9
                return new YamlParser();
14
            default:
15 1
                throw new Exception\InvalidParserException($type);
16
        }
17
    }
18
}
19