Conditions | 5 |
Paths | 12 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
55 | 7 | private function doNgrams($data, $n = 1, $cyclic = true) |
|
56 | { |
||
57 | 7 | $dataLength = count($data); |
|
58 | |||
59 | 7 | $n = $n > $dataLength ? $dataLength : $n; |
|
60 | |||
61 | 7 | $length = (false === $cyclic ? $dataLength - $n + 1 : $dataLength); |
|
62 | |||
63 | 7 | for ($j = 0; $j < $length; $j++) { |
|
64 | 7 | $ngrams = []; |
|
65 | 7 | for ($i = $j; $i < $n + $j; $i++) { |
|
66 | 7 | $ngrams[] = $data[$i%$dataLength]; |
|
67 | } |
||
68 | 7 | yield $ngrams; |
|
69 | } |
||
70 | 7 | } |
|
71 | } |
||
72 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.