Completed
Pull Request — master (#193)
by Enrico
06:57 queued 02:48
created

Factory::factory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 37
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 35
nc 1
nop 1
dl 0
loc 47
ccs 37
cts 37
cp 1
crap 1
rs 9.0303
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 1
                new AnalyzerPass\Expression\EvalUsage(),
28 1
                new AnalyzerPass\Expression\FinalStaticUsage(),
29
                // Arrays
30 1
                new AnalyzerPass\Expression\ArrayShortDefinition(),
31 1
                new AnalyzerPass\Expression\ArrayDuplicateKeys(),
32 1
                new AnalyzerPass\Expression\ArrayIllegalOffsetType(),
33
                // Function call
34 1
                new AnalyzerPass\Expression\FunctionCall\AliasCheck(),
35 1
                new AnalyzerPass\Expression\FunctionCall\DebugCode(),
36 1
                new AnalyzerPass\Expression\FunctionCall\RandomApiMigration(),
37 1
                new AnalyzerPass\Expression\FunctionCall\UseCast(),
38 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedIniOptions(),
39 1
                new AnalyzerPass\Expression\FunctionCall\RegularExpressions(),
40 1
                new AnalyzerPass\Expression\FunctionCall\ArgumentUnpacking(),
41 1
                new AnalyzerPass\Expression\FunctionCall\DeprecatedFunctions(),
42
            ]
43 1
        );
44 1
        $analyzer->registerStatementPasses(
45
            [
46 1
                new AnalyzerPass\Statement\MagicMethod\GetParametersCheck(),
47 1
                new AnalyzerPass\Statement\DoNotUseGoto(),
48 1
                new AnalyzerPass\Statement\HasMoreThanOneProperty(),
49 1
                new AnalyzerPass\Statement\MissingBreakStatement(),
50 1
                new AnalyzerPass\Statement\MissingVisibility(),
51 1
                new AnalyzerPass\Statement\MethodCannotReturn(),
52 1
                new AnalyzerPass\Statement\UnexpectedUseOfThis(),
53 1
                new AnalyzerPass\Statement\TestAnnotation(),
54 1
                new AnalyzerPass\Statement\MissingDocblock(),
55 1
                new AnalyzerPass\Statement\OldConstructor(),
56 1
                new AnalyzerPass\Statement\ConstantNaming(),
57 1
                new AnalyzerPass\Statement\DoNotUseInlineHTML(),
58 1
                new AnalyzerPass\Statement\AssignmentInCondition(),
59
            ]
60 1
        );
61 1
        $analyzer->bind();
62
63 1
        return $analyzer;
64
    }
65
}
66