Completed
Push — master ( 5bac00...4dd860 )
by Nikola
02:03
created

Parser::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
/*
3
 * This file is part of the Abstract builder package, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\AbstractBuilder\Ast;
11
12
use PhpParser\Lexer\Emulative;
13
use PhpParser\Parser\Php7;
14
15
/**
16
 * Class Parser
17
 *
18
 * @package RunOpenCode\AbstractBuilder\Ast
19
 */
20
class Parser extends Php7
21
{
22
    /**
23
     * @var Parser
24
     */
25
    private static $instance;
26
27
    /**
28
     * Get shared parser instance. Singleton implementation.
29
     *
30
     * @return Parser|static
31
     */
32 1
    public static function getInstance()
33
    {
34 1
        if (null === self::$instance) {
35 1
            self::$instance = new Parser(new Emulative(), []);
36
        }
37
38 1
        return self::$instance;
39
    }
40
}
41