Completed
Push — master ( b11566...550d6f )
by Pol
02:19
created

Perfect   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generator() 0 3 1
A get() 0 7 3
1
<?php
2
3
namespace drupol\phpermutations\Generators;
4
5
use drupol\phpermutations\Iterators\Perfect as PerfectIterator;
6
7
/**
8
 * Class Perfect.
9
 *
10
 * @package drupol\phpermutations\Generators
11
 */
12
class Perfect extends PerfectIterator {
13
14
  /**
15
   * @var int
16
   */
17
  protected $max;
18
19
  /**
20
   * @return \Generator
21
   */
22
  public function generator() {
23
    return $this->get();
24
  }
25
26
  /**
27
   * @return \Generator
28
   */
29
  protected function get() {
30
    for ($j = 2; $j <= $this->getMaxLimit(); $j++) {
31
      if ($this->isPerfectNumber($j)) {
32
        yield $j;
33
      }
34
    }
35
  }
36
37
}
38