Passed
Branch master (168fd2)
by Dariusz
06:34
created

CartPrices   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 32
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A totalNet() 0 4 1
A totalGross() 0 4 1
A tax() 0 4 1
A totalAfterDiscounts() 0 4 1
A shippingCost() 0 4 1
A paymentFee() 0 4 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the Plane\Shop package.
5
 *
6
 * (c) Dariusz Korsak <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Plane\Shop\Traits;
13
14
use Money\Money;
15
16
trait CartPrices
17
{
18
    public function totalNet(): Money
19
    {
20
        return $this->cart->totalNet();
0 ignored issues
show
Bug introduced by
The property cart does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
    }
22
23
    public function totalGross(): Money
24
    {
25
        return $this->cart->totalGross();
26
    }
27
    
28
    public function tax(): Money
29
    {
30
        return $this->cart->tax();
31
    }
32
    
33
    public function totalAfterDiscounts(): Money
34
    {
35
        return $this->cart->totalAfterDiscounts();
36
    }
37
    
38
    public function shippingCost(): Money
39
    {
40
        return $this->cart->shippingCost();
41
    }
42
    
43
    public function paymentFee(): Money
44
    {
45
        return $this->cart->paymentFee();
46
    }
47
}
48