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

BacktickUsage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pass() 0 10 1
A getRegister() 0 6 1
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