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

CartPrices::totalAfterDiscounts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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