1 | <?php |
||
7 | class Command extends AbstractEntity |
||
8 | { |
||
9 | const ENTITY_TYPE = 'Command'; |
||
10 | |||
11 | const PREFIX = '/'; |
||
12 | |||
13 | const ARGS_SEPARATOR = ' '; |
||
14 | |||
15 | const PARTS_DELIMITER = '_'; |
||
16 | |||
17 | const PATTERN_COMMAND_ON_FIRST = '/^\/[a-zA-Z_]+.*$/'; |
||
18 | |||
19 | const PATTERN_COMMAND_ON_ANY = '/\/[a-zA-Z_]+.*$/'; |
||
20 | |||
21 | const PATTERN_COMMAND_DATA = '/.*\/(?P<name>\w+)\b(?P<args>.*)$/'; |
||
22 | |||
23 | protected $text; |
||
24 | |||
25 | protected $name; |
||
26 | |||
27 | protected $args; |
||
28 | |||
29 | public function __construct(array $data) |
||
45 | |||
46 | /** |
||
47 | * @return mixed |
||
48 | */ |
||
49 | public function getName() |
||
53 | |||
54 | /** |
||
55 | * @return mixed |
||
56 | */ |
||
57 | public function getArgs() |
||
61 | |||
62 | protected function getCommandDataFromText($text) |
||
83 | } |
||
84 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.