FiniteGroup   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 5
cp 0
rs 10

2 Methods

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