Completed
Push — master ( 789135...16eacb )
by Enrico
11s
created

BacktickUsage::getRegister()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 2
cts 2
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace PHPSA\Analyzer\Pass\Expression;
4
5
use PhpParser\Node\Expr;
6
use PHPSA\Analyzer\Pass\AnalyzerPassInterface;
7
use PHPSA\Context;
8
9
class BacktickUsage implements AnalyzerPassInterface
10
{
11
    /**
12
     * @param Expr\ShellExec $expr
13
     * @param Context $context
14
     * @return bool
15
     */
16 1
    public function pass(Expr\ShellExec $expr, Context $context)
17
    {
18 1
        $context->notice(
19 1
            'backtick_usage',
20 1
            'It\'s bad practice to use the backtick operator for shell execution',
21
            $expr
22 1
        );
23
24 1
        return true;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 1
    public function getRegister()
31
    {
32
        return [
33
            Expr\ShellExec::class
34 1
        ];
35
    }
36
}
37