Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
48 | public static function swaprandbyte($inp) |
||
49 | { |
||
50 | // @codeCoverageIgnoreStart |
||
51 | $len = strlen($inp); |
||
|
|||
52 | $inp = str_split($inp); |
||
53 | $off = rand(0, $len - 1); |
||
54 | $byte = $inp[$off]; |
||
55 | $rbyte = \Dcrypt\Random::bytes(1); |
||
56 | if ($byte === $rbyte) { |
||
57 | $rbyte = (ord($rbyte) + 1) % 256; |
||
58 | $rbyte = chr($rbyte); |
||
59 | } |
||
60 | $inp[$off] = $rbyte; |
||
61 | |||
62 | // @codeCoverageIgnoreEnd |
||
63 | return implode($inp); |
||
64 | } |
||
65 | |||
67 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.