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

Perfect::generator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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