Item   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 12
dl 0
loc 36
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getQuantity() 0 3 1
A setQuantity() 0 3 1
A getId() 0 3 1
A setPrice() 0 3 1
A __construct() 0 5 1
A getPrice() 0 3 1
1
<?php
2
3
namespace MrPrompt\ShoppingCart;
4
5
use MrPrompt\ShoppingCart\Contracts\ItemInterface;
6
7
class Item implements ItemInterface
8
{
9
    private $id;
10
    private $price;
11
    private $quantity;
12
13 7
    public function __construct(string $id, float $price = 0.00, int $quantity = 1)
14
    {
15 7
        $this->id = $id;
16 7
        $this->price = $price;
17 7
        $this->quantity = $quantity;
18 7
    }
19
20 1
    public function getId(): string
21
    {
22 1
        return $this->id;
23
    }
24
25 1
    public function getQuantity(): int
26
    {
27 1
        return $this->quantity;
28
    }
29
30 1
    public function setQuantity(int $quantity)
31
    {
32 1
        $this->quantity = $quantity;
33 1
    }
34
35 1
    public function getPrice(): float
36
    {
37 1
        return $this->price;
38
    }
39
40 1
    public function setPrice(float $price)
41
    {
42 1
        $this->price = $price;
43 1
    }
44
}
45