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

BacktickUsage::pass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 10
ccs 6
cts 6
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