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

NGrams   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
cbo 1
dl 0
loc 35
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A generator() 0 4 1
A toArray() 0 4 1
A get() 0 7 2
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