Avoid variables with short names like $n. Configured minimum length is 3.
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.
Loading history...
15
{
16
3
return $this->doNgrams($data, $n, $cyclic);
17
}
18
19
/**
20
* @param string $data
21
* @param int $n
22
* @param bool $cyclic
23
*
24
* @return \Generator
25
*/
26
3
public function ngramsString($data, $n = 1, $cyclic = true)
Avoid variables with short names like $n. Configured minimum length is 3.
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.
Loading history...
27
{
28
3
foreach ($this->doNgrams(str_split($data), $n, $cyclic) as $data) {
29
3
yield implode('', $data);
30
}
31
3
}
32
33
/**
34
* @param $data
35
* @param $n
36
* @param $cyclic
37
*
38
* @return \Generator
39
*/
40
6
private function doNgrams($data, $n = 1, $cyclic = true)
Avoid variables with short names like $n. Configured minimum length is 3.
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.
Avoid variables with short names like $n. Configured minimum length is 3.
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.
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.