NGrams   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 30
ccs 0
cts 13
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 2
A generator() 0 3 1
A toArray() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace drupol\phpermutations\Generators;
6
7
use drupol\phpermutations\GeneratorInterface;
8
use drupol\phpermutations\Iterators\NGrams as NGramsIterator;
9
use Generator;
10
11
class NGrams extends NGramsIterator implements GeneratorInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function generator(): Generator
17
    {
18
        return $this->get();
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function toArray(): array
25
    {
26
        return [];
27
    }
28
29
    /**
30
     * Get the generator.
31
     *
32
     * @return Generator<int>
33
     *                    The generator
34
     */
35
    protected function get(): Generator
36
    {
37
        while (true) {
38
            $this->next();
39
40
            yield $this->current();
41
        }
42
    }
43
}
44