Slide 47
Slide 47 text
Creating a Supper Dupper Combo
$products = [
new HardProduct('Digital Camera', new EUR(78900), new Mass(855)),
new HardProduct('Camera Bag', new EUR(3900), new Mass(220)),
new HardProduct('Memory Card 128 Gb', new EUR(7900), new Mass(42)),
];
$combo = new Combo('Digital Camera Combo Pack + Tripod', [
new HardProduct('Lightweight Tripod', new EUR(2690), new Mass(570)),
new Combo('Digital Camera & Bag', $products, new EUR(83900)),
]);
echo 'Name: ', $combo->getName() ,"\n";
echo 'Weight: ', $combo->getWeight()->getValue() ,"\n";
echo 'Price: ', $combo->getPrice()->getConvertedAmount() ,"\n";
Name: Digital Camera Combo Pack + Tripod
Mass: 1687 g
Price: 865.90 €