FakeCartPosition::getPrice()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * Cart module for Yii2
5
 *
6
 * @link      https://github.com/hiqdev/yii2-cart
7
 * @package   yii2-cart
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\yii2\cart\tests\unit;
13
14
use hiqdev\yii2\cart\CartPositionInterface;
15
use hiqdev\yii2\cart\CartPositionTrait;
16
17
class FakeCartPosition extends \yii\base\BaseObject implements CartPositionInterface
18
{
19
    use CartPositionTrait;
20
21
    public $id;
22
    public $price;
23
    public $discount;
24
25
    public function getId()
26
    {
27
        return $this->id;
28
    }
29
30
    public function getPrice()
31
    {
32
        return $this->price;
33
    }
34
35
    public function getCost($withDiscount = true)
36
    {
37
        return $this->price * $this->quantity - ($withDiscount ? $this->discount * $this->quantity : 0);
38
    }
39
40
    public function getQuantityOptions() {
41
        return [];
42
    }
43
}
44