Completed
Push — master ( cfa785...3f4fca )
by Дмитрий
02:53
created

Factory::factory()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 14
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 25
ccs 17
cts 17
cp 1
crap 1
rs 8.8571
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA\Analyzer;
7
8
use PHPSA\Analyzer;
9
use Webiny\Component\EventManager\EventManager;
10
use PHPSA\Analyzer\Pass as AnalyzerPass;
11
12
class Factory
13
{
14
    /**
15
     * @param EventManager $eventManager
16
     * @return Analyzer
17
     */
18 1
    static public function factory(EventManager $eventManager)
0 ignored issues
show
Best Practice introduced by
Using PHP4-style constructors that are named like the class is not recommend; better use the more explicit __construct method.
Loading history...
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
19
    {
20 1
        $analyzer = new Analyzer($eventManager);
21 1
        $analyzer->registerExpressionPasses(
22
            [
23
                // Another
24 1
                new AnalyzerPass\Expression\ArrayShortDefinition(),
25
                // Function call
26 1
                new AnalyzerPass\Expression\FunctionCall\AliasCheck(),
27 1
                new AnalyzerPass\Expression\FunctionCall\DebugCode(),
28 1
                new AnalyzerPass\Expression\FunctionCall\RandomApiMigration(),
29 1
                new AnalyzerPass\Expression\FunctionCall\UseCast(),
30 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedIniOptions(),
31 1
                new AnalyzerPass\Expression\FunctionCall\RegularExpressions(),
32
            ]
33 1
        );
34 1
        $analyzer->registerStatementPasses(
35
            [
36 1
                new AnalyzerPass\Statement\MethodCannotReturn()
37 1
            ]
38 1
        );
39 1
        $analyzer->bind();
40
41 1
        return $analyzer;
42
    }
43
}
44