Completed
Push — master ( a49478...ff8a6e )
by Pol
01:00 queued 10s
created

NGrams::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
3
namespace drupol\phpermutations\Generators;
4
5
use drupol\phpermutations\GeneratorInterface;
6
use drupol\phpermutations\Iterators\NGrams as NGramsIterator;
7
8
/**
9
 * Class NGrams.
10
 */
11
class NGrams extends NGramsIterator implements GeneratorInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function generator()
17
    {
18
        return $this->get();
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function toArray()
25
    {
26
        return [];
27
    }
28
29
    /**
30
     * Get the generator.
31
     *
32
     * @codingStandardsIgnoreStart
33
     *
34
     * @return \Generator
35
     *                    The generator
36
     * @codingStandardsIgnoreEnd
37
     */
38
    protected function get()
39
    {
40
        while (true) {
41
            $this->next();
42
            yield $this->current();
43
        }
44
    }
45
}
46