Completed
Pull Request — master (#119)
by T
03:42
created

Factory   B

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 16

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 39
ccs 23
cts 23
cp 1
rs 8.4614
wmc 1
lcom 0
cbo 16

1 Method

Rating   Name   Duplication   Size   Complexity  
B factory() 0 32 1
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\ArrayShortDefinition(),
25 1
                new AnalyzerPass\Expression\ErrorSuppression(),
26 1
                new AnalyzerPass\Expression\VariableVariableUsage(),
27
                // Function call
28 1
                new AnalyzerPass\Expression\FunctionCall\AliasCheck(),
29 1
                new AnalyzerPass\Expression\FunctionCall\DebugCode(),
30 1
                new AnalyzerPass\Expression\FunctionCall\RandomApiMigration(),
31 1
                new AnalyzerPass\Expression\FunctionCall\UseCast(),
32 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedIniOptions(),
33 1
                new AnalyzerPass\Expression\FunctionCall\RegularExpressions(),
34 1
                new AnalyzerPass\Expression\FunctionCall\ArgumentUnpacking(),
35 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedFunctions(),
36
            ]
37 1
        );
38 1
        $analyzer->registerStatementPasses(
39
            [
40 1
                new AnalyzerPass\Statement\MissingBreakStatement(),
41 1
                new AnalyzerPass\Statement\MethodCannotReturn(),
42 1
                new AnalyzerPass\Statement\UnexpectedUseOfThis(),
43 1
                new AnalyzerPass\Statement\DoNotUseGoto(),
44
            ]
45 1
        );
46 1
        $analyzer->bind();
47
48 1
        return $analyzer;
49
    }
50
}
51