FiniteGroup::generator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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\FiniteGroup as FiniteGroupIterator;
9
use Generator;
10
11
/**
12
 * Class FiniteGroup.
13
 *
14
 * The finite group is an abelian finite cyclic group.
15
 */
16
class FiniteGroup extends FiniteGroupIterator implements GeneratorInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function generator(): Generator
22
    {
23
        return $this->get();
24
    }
25
26
    /**
27
     * The generator.
28
     *
29
     * @return Generator<int>
30
     *                    The finite group generator
31
     */
32
    protected function get(): Generator
33
    {
34
        foreach ($this->group as $number) {
35
            yield $number;
36
        }
37
    }
38
}
39