Completed
Push — master ( 90421b...89471b )
by Дмитрий
48s
created

Factory::factory()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 26
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 24
nc 1
nop 1
dl 0
loc 36
ccs 26
cts 26
cp 1
crap 1
rs 8.8571
c 0
b 0
f 0
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
    public static 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...
19
    {
20 1
        $analyzer = new Analyzer($eventManager);
21 1
        $analyzer->registerExpressionPasses(
22
            [
23
                // Another
24 1
                new AnalyzerPass\Expression\ErrorSuppression(),
25 1
                new AnalyzerPass\Expression\VariableVariableUsage(),
26 1
                new AnalyzerPass\Expression\Casts(),
27
                // Arrays
28 1
                new AnalyzerPass\Expression\ArrayShortDefinition(),
29 1
                new AnalyzerPass\Expression\ArrayDuplicateKeys(),
30
                // Function call
31 1
                new AnalyzerPass\Expression\FunctionCall\AliasCheck(),
32 1
                new AnalyzerPass\Expression\FunctionCall\DebugCode(),
33 1
                new AnalyzerPass\Expression\FunctionCall\RandomApiMigration(),
34 1
                new AnalyzerPass\Expression\FunctionCall\UseCast(),
35 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedIniOptions(),
36 1
                new AnalyzerPass\Expression\FunctionCall\RegularExpressions(),
37 1
                new AnalyzerPass\Expression\FunctionCall\ArgumentUnpacking(),
38 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedFunctions(),
39
            ]
40 1
        );
41 1
        $analyzer->registerStatementPasses(
42
            [
43 1
                new AnalyzerPass\Statement\DoNotUseGoto(),
44 1
                new AnalyzerPass\Statement\MissingBreakStatement(),
45 1
                new AnalyzerPass\Statement\MethodCannotReturn(),
46 1
                new AnalyzerPass\Statement\UnexpectedUseOfThis(),
47 1
                new AnalyzerPass\Statement\OldConstructor(),
48
            ]
49 1
        );
50 1
        $analyzer->bind();
51
52 1
        return $analyzer;
53
    }
54
}
55