Completed
Push — master ( f42091...b2313d )
by Pol
02:14
created

Product   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
cbo 0
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B generator() 0 14 5
1
<?php
2
3
namespace drupol\phpermutations\Generators;
4
5
/**
6
 * Class Product.
7
 *
8
 * @package drupol\phpermutations\Generators
9
 */
10
class Product {
11
12
  /**
13
   * @param $data
14
   *
15
   * @return \Generator
16
   */
17 2
  public function generator($data) {
18 2
    if ($data) {
19 2
      if ($u = array_pop($data)) {
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $u. 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...
20 2
        foreach ($this->generator($data) as $p) {
21 2
          foreach ($u as $v) {
22 2
            yield $p + [count($p) => $v];
23 2
          }
24 2
        }
25 2
      }
26 2
    }
27
    else {
28 2
      yield [];
29
    }
30 2
  }
31
32
}
33