ParserFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 8 2
1
<?php declare(strict_types=1);
2
3
namespace HSkrasek\OpenAPI\Parsers;
4
5
class ParserFactory
6
{
7
    /**
8
     * Create a parser based on the provided format
9
     *
10
     * @param string $format
11
     *
12
     * @return ParserInterface
13
     */
14
    public static function make(string $format): ParserInterface
15
    {
16
        if (strtolower($format) === 'json') {
17
            return new JsonParser;
18
        }
19
20
        return new YamlParser;
21
    }
22
}
23