Completed
Push — master ( 0318a4...4ae196 )
by Pol
02:45
created

Prime::get()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 6
Ratio 75 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 6
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 0
crap 12
1
<?php
2
3
namespace drupol\phpermutations\Generators;
4
5
/**
6
 * Class Prime.
7
 *
8
 * @package drupol\phpermutations\Generators
9
 */
10
class Prime extends \drupol\phpermutations\Iterators\Prime {
11
12
  /**
13
   * @var int
14
   */
15
  protected $max;
16
17
  /**
18
   * @return \Generator
19
   */
20
  public function generator() {
21
    return $this->get();
22
  }
23
24
  /**
25
   * @return \Generator
26
   */
27
  protected function get() {
28 View Code Duplication
    for ($j = 2; $j <= $this->getMaxLimit(); $j++) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
      if ($this->isPrimeNumber($j)) {
30
        $this->count++;
31
        yield $j;
32
      }
33
    }
34
  }
35
36
}
37