FakeCartPosition   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getPrice() 0 4 1
A getCost() 0 4 2
A getQuantityOptions() 0 3 1
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