ParserFactory::getInstance()   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 3
crap 2
1
<?php
2
3
namespace League\CLImate\Decorator\Parser;
4
5
use League\CLImate\Util\System\System;
6
use League\CLImate\Decorator\Tags;
7
8
class ParserFactory
9
{
10
    /**
11
     * Get an instance of the appropriate Parser class
12
     *
13
     * @param System $system
14
     * @param array $current
15
     * @param Tags $tags
16
     * @return Parser
17
     */
18 572
    public static function getInstance(System $system, array $current, Tags $tags)
19
    {
20 572
        if ($system->hasAnsiSupport()) {
21 564
            return new Ansi($current, $tags);
22
        }
23
24 8
        return new NonAnsi($current, $tags);
25
    }
26
}
27