CouponSheetsAwareTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setCouponSheets() 0 12 3
1
<?php
2
namespace Germania\Coupons;
3
4
trait CouponSheetsAwareTrait
5
{
6
7
    use CouponSheetsProviderTrait;
8
9
    /**
10
     * @param array|Traversable $coupon_sheet
0 ignored issues
show
Documentation introduced by
There is no parameter named $coupon_sheet. Did you maybe mean $coupon_sheets?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
11
     * @implements CouponSheetsAwareInterface
12
     * @return self Fluid Interface
13
     */
14 5
    public function setCouponSheets( $coupon_sheets )
15
    {
16 5
        if ($coupon_sheets instanceOf \Traversable)
17 5
            $coupon_sheets = iterator_to_array( $coupon_sheets, "use_keys");
18
19 5
        elseif (!is_array($coupon_sheets))
20 5
            throw new \InvalidArgumentException("Array or Traversable expected");
21
22
23 5
        $this->coupon_sheets = $coupon_sheets;
24 5
        return $this;
25
    }
26
27
28
29
}
30