Item::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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