-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart.php
More file actions
53 lines (48 loc) · 885 Bytes
/
cart.php
File metadata and controls
53 lines (48 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
include __DIR__ . "/interfaces/CartInterface.php";
/*** Products ***
Title Price
Valheim 19.99
Loop Hero 12.74
Rust 39.99
Hades 24.99
*/
$products = [
[
'id' => 1,
'title' => 'Valheim',
'price' => 19.99,
],
[
'id' => 2,
'title' => 'Loop Hero',
'price' => 12.74,
],
[
'id' => 3,
'title' => 'Rust',
'price' => 39.99,
],
[
'id' => 4,
'title' => 'Hades',
'price' => 24.99,
],
];
function getProductById($id){
// return product
// throw error if not found
}
// Implement this class
/*
class Cart implements Interfaces\CartInterface {
public $cartItems = [
/* [
'id' => product id,
'title' => product title
'price' => product price
'quantity' => cart item quantity
]/*
];
}
*/