ParserFactory::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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