Completed
Push — master ( 4ae196...831fe8 )
by Pol
02:12
created

Fibonacci::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 9
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
crap 6
1
<?php
2
3
namespace drupol\phpermutations\Generators;
4
5
/**
6
 * Class Fibonacci.
7
 *
8
 * @package drupol\phpermutations\Generators
9
 */
10
class Fibonacci extends \drupol\phpermutations\Iterators\Fibonacci {
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
    $a = 0;
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $a. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
29
    $b = 1;
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $b. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
30
    $to = $this->getMaxLimit();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $to. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
31
    while ($to > 0) {
32
      yield $a;
33
34
      list($a, $b) = array($b, $a + $b);
35
      $to--;
36
    }
37
  }
38
39
}
40