Conditions | 3 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function encode($text) |
||
24 | { |
||
25 | $block_size = PKCS7Encoder::$block_size; |
||
|
|||
26 | $text_length = strlen($text); |
||
27 | //计算需要填充的位数 |
||
28 | $amount_to_pad = PKCS7Encoder::$block_size - ($text_length % PKCS7Encoder::$block_size); |
||
29 | if ($amount_to_pad == 0) { |
||
30 | $amount_to_pad = PKCS7Encoder::block_size; |
||
31 | } |
||
32 | //获得补位所用的字符 |
||
33 | $pad_chr = chr($amount_to_pad); |
||
34 | $tmp = ""; |
||
35 | for ($index = 0; $index < $amount_to_pad; $index++) { |
||
36 | $tmp .= $pad_chr; |
||
37 | } |
||
38 | |||
39 | return $text . $tmp; |
||
40 | } |
||
41 | |||
59 |
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.