afterAdd()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 4
rs 10
1
<?php
2
3
namespace SilverShop\Tests\Cart;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\Dev\TestOnly;
7
8
class ShoppingCartTest_TestShoppingCartErroringHooksExtension extends Extension implements TestOnly
9
{
10
    public function beforeSetQuantity($buyable, $quantity, $filter)
0 ignored issues
show
Unused Code introduced by
The parameter $buyable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

10
    public function beforeSetQuantity(/** @scrutinizer ignore-unused */ $buyable, $quantity, $filter)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $filter is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

10
    public function beforeSetQuantity($buyable, $quantity, /** @scrutinizer ignore-unused */ $filter)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
11
    {
12
        if ($quantity > 10) {
13
            throw new \Exception('Invalid quantity');
14
        }
15
    }
16
17
    public function afterAdd($item, $buyable, $quantity, $filter)
0 ignored issues
show
Unused Code introduced by
The parameter $quantity is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function afterAdd($item, $buyable, /** @scrutinizer ignore-unused */ $quantity, $filter)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $filter is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function afterAdd($item, $buyable, $quantity, /** @scrutinizer ignore-unused */ $filter)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $buyable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function afterAdd($item, /** @scrutinizer ignore-unused */ $buyable, $quantity, $filter)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        if ($item->Quantity > 1) {
20
            throw new \Exception('Invalid quantity');
21
        }
22
    }
23
}
24