Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 2 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
48 | 4 | public static function swaprandbyte($input) |
|
49 | { |
||
50 | // @codeCoverageIgnoreStart |
||
51 | $len = strlen($input); |
||
|
|||
52 | $input = str_split($input); |
||
53 | $offset = rand(0, $len - 1); |
||
54 | $byte = $input[$offset]; |
||
55 | $rbyte = \Dcrypt\Random::bytes(1); |
||
56 | if ($byte === $rbyte) { |
||
57 | $rbyte = (ord($rbyte) + 1) % 256; |
||
58 | $rbyte = chr($rbyte); |
||
59 | } |
||
60 | $input[$offset] = $rbyte; |
||
61 | |||
62 | // @codeCoverageIgnoreEnd |
||
63 | 4 | return implode($input); |
|
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.