Completed
Push — php7 ( e63b6c...54c9f9 )
by Akihito
01:32
created

ParserFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 11
ccs 2
cts 3
cp 0.6667
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A newInstance() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the Ray.Aop package
6
 *
7
 * @license http://opensource.org/licenses/MIT MIT
8
 */
9
namespace Ray\Aop;
10
11
use PhpParser\Lexer;
12
use PhpParser\Parser;
13
use PhpParser\ParserFactory as PhpParserFactory;
14
15
class ParserFactory
16
{
17 27
    public function newInstance()
18
    {
19 27
        if (class_exists('PhpParser\ParserFactory')) {
20
            return (new PhpParserFactory)->create(PhpParserFactory::PREFER_PHP7);
21
        }
22
23
        return new Parser(new Lexer());  // @codeCoverageIgnore
24
    }
25
}
26