-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
609 lines (557 loc) · 31.5 KB
/
main.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
<?php
use utils\AbstractClassLoader;
use utils\ClassLoader;
require_once 'src/utils/AbstractClassLoader.php';
require_once 'src/utils/ClassLoader.php';
$loader = new \utils\ClassLoader('src');
$loader->register();
use pizzapp\Admin\resources\Recipe;
use pizzapp\Admin\resources\Command;
use pizzapp\Admin\resources\Ingredient;
use pizzapp\Admin\Manager;
use pizzapp\Client\Customer;
use pizzapp\Client\CustomRecipe;
#region non-interactive version
// Ingredients creation
$S_dough = new Ingredient("dough(S)", 10, "3.00", "base");
$M_dough = new Ingredient("dough(M)", 10, "4.00", "base");
$L_dough = new Ingredient("dough(L)", 10, "6.00", "base");
$XL_dough = new Ingredient("dough(XL)", 10, "7.00", "base");
$XXL_dough = new Ingredient("dough(XXL)", 10, "7.50", "base");
$cream = new Ingredient("cream", 10, "2.00", "base");
$tomato = new Ingredient("tomato", 10, "1.50", "base");
$mushroom = new Ingredient("mushroom", 8, "0.20", "ingredient");
$cheese = new Ingredient("cheese", 20, "0.50", "ingredient");
$chorizo = new Ingredient("chorizo", 10, "0.70", "ingredient");
$pineapple = new Ingredient("pineapple", 5, "1.00", "ingredient");
$egg = new Ingredient("egg", 20, "0.40", "ingredient");
$ham = new Ingredient("ham", 10, "1.10", "ingredient");
$mozzarella = new Ingredient("mozzarella", 10, "0.55", "ingredient");
$basilic = new Ingredient("basilic", 15, "0.10", "ingredient");
$potatoe = new Ingredient("potatoe", 20, "0.15", "ingredient");
$onion = new Ingredient("onion", 5, "0.45", "ingredient");
// Recipes creation
$regina_dough_size = $S_dough;
$regina = new Recipe("regina", [$regina_dough_size, $tomato], [$ham, $cheese, $mushroom]);
$napolitaine_dough_size = $M_dough;
$napolitaine = new Recipe("napolitaine", [$napolitaine_dough_size, $tomato], [$mozzarella, $basilic, $cheese]);
$raclette_dough_size = $XXL_dough;
$raclette = new Recipe("raclette", [$raclette_dough_size, $cream], [$potatoe, $cheese, $mushroom, $onion]);
// Manager
$manager = new Manager();
// Adding ingredients to stock to make them available to customers
$manager->addIngredientToStock($S_dough);
$manager->addIngredientToStock($M_dough);
$manager->addIngredientToStock($L_dough);
$manager->addIngredientToStock($XL_dough);
$manager->addIngredientToStock($XXL_dough);
$manager->addIngredientToStock($cream);
$manager->addIngredientToStock($tomato);
$manager->addIngredientToStock($mushroom);
$manager->addIngredientToStock($cheese);
$manager->addIngredientToStock($chorizo);
$manager->addIngredientToStock($pineapple);
$manager->addIngredientToStock($egg);
$manager->addIngredientToStock($ham);
$manager->addIngredientToStock($mozzarella);
$manager->addIngredientToStock($basilic);
$manager->addIngredientToStock($potatoe);
$manager->addIngredientToStock($onion);
// Add recipes to stock to make them available to customers
$manager->addRecipe($regina);
$manager->addRecipe($napolitaine);
$manager->addRecipe($raclette);
echo "\nCUSTOMER A:";
// - un client A sélectionne une pizza parmi la liste des pizzas disponibles
// - le client A sélectionne d'autres pizzas
// - le client A obtient le montant de sa commande
$customer_A = new Customer("Bob Leponge");
$command_A = new Command($customer_A);
$command_A->addItem(Recipe::$recipes_list["regina"], null);
$command_A->addItem(Recipe::$recipes_list["napolitaine"], null);
// Finishing
$command_A->getCommand();
$customer_A->addCommand($command_A);
echo "\n\nCUSTOMER B:";
// - un client B sélectionne une pizza
// - le client B ajoute ou supprime un ou plusieurs ingrédients
// - le client B obtient le montant de sa commande
$customer_B = new Customer("Michael Scott");
$command_B = new Command($customer_B);
$command_B->addItem(Recipe::$recipes_list["regina"], null);
$command_B->addItem(Recipe::$recipes_list["napolitaine"], null);
echo "\nCommand before modifications : ";
$command_B->getCommand();
echo "\n\nModifications : \n";
// adding ingredients to an already existing pizza
$custom_recipe = new CustomRecipe($command_B->items[0]->name);
// Overwrite Recipe index with CustomRecipe
// index 1 to modify the first pizza
$command_B->addItem($custom_recipe, "1");
$custom_recipe->addIngredientToRecipe("egg");
$custom_recipe->addIngredientToRecipe("mozzarella");
// Removing ingredients from an already existing pizza
$custom_recipe = new CustomRecipe($command_B->items[1]->name);
// Overwrite Recipe index with CustomRecipe
// index 2 to modify the second pizza
$command_B->addItem($custom_recipe, "2");
$custom_recipe->removeIngredientFromRecipe("cheese");
// Finishing
$command_B->getCommand();
$customer_B->addCommand($command_B);
echo "\n\nCUSTOMER C:";
// - le client C sélectionne une pizza custom
// - le client C compose sa pizza custom (soit via des méthodes random soit via une sélection codée à l'avance)
// - le client C obtient le montant de sa commande
$customer_C = new Customer("Ace Ventura");
$command_C = new Command($customer_C);
$ingredients_to_add_array = ["tomato" , "cheese", "mushroom", "ham"];
foreach ($ingredients_to_add_array as $ingredient) {
if (Ingredient::$ingredients_list[$ingredient]->type == "base") {
$base_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
}
if (Ingredient::$ingredients_list[$ingredient]->type == "ingredient") {
$ingredients_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
}
}
// Create real Recipe
$empty_recipe = new Recipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
// to create a CustomRecipe from it
$custom_recipe = new CustomRecipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
$quantite_custom_pizza = 2;
if ($quantite_custom_pizza > 0) {
for ($i = 0; $i < $quantite_custom_pizza; $i++) {
$command_C->addItem($custom_recipe, null);
}
}
// then delete the real recipe
unset(Recipe::$recipes_list[$empty_recipe->name]);
// Finishing
$command_C->getCommand();
$customer_C->addCommand($command_C);
echo "\n";
#endregion
#region - Interactive version
// require_once("assets.php");
// echo "Welcome to MarioPizza's App !\n";
// while (true) {
// // Step 1
// //User type choice :
// echo "1 : Customer \n";
// echo "2 : Administrator\n";
// echo "3 : Exit\n";
// while (true) {
// $usertype = readline("What kind of user are you ? :");
// if ($usertype == 1 || $usertype == 2 || $usertype == 3) {
// break;
// } else {
// echo "Please, enter correct user type.\n";
// }
// }
// //CUSTOMER PART:
// if ($usertype == 1) {
// echo "\nYour choice : Client\n";
// $customer_name = readline("Enter your name : ");
// echo "\n1 : Select a pizza in the list";
// echo "\n2 : Create your own pizza\n";
// $action = readline("Your choice : ");
// $customer = new Customer($customer_name);
// $command = new Command($customer);
// $recipes = Recipe::$recipes_list;
// if ($action == "1") {
// while (true) {
// Recipe::showRecipes();
// echo "\n\n- If you want more than one, separate names with commas\n- One occurence will count as one pizza so if you want the same pizza 'x' times, type its name 'x' times separated with commas\n";
// $pizza_name = readline("Enter the name of the pizza you want : ");
// // To avoid name conflicts :
// $pizza_name = str_replace(' ', '', $pizza_name);
// $pizza_name_array = explode(',', $pizza_name);
// $pizza_name_array = array_filter($pizza_name_array);
// // Adding recipes to command
// foreach ($pizza_name_array as $pizza_name) {
// $command->addItem($recipes[$pizza_name], null);
// }
// while (true) {
// // Command resume :
// echo ("\nYour command :");
// $command->getCommand();
// echo "\n";
// $modify_choice = readline("Do you want to modify your command ? [Yes / No] : ");
// if ($modify_choice == "Yes") {
// while (true) {
// echo "1 : Remove or add a pizza to your command\n";
// echo "2 : Remove or add an ingredient to a pizza\n";
// echo "3 : Cancel\n";
// $modify_choice = readline("Your choice : ");
// echo "\n";
// if ($modify_choice == "1") {
// while (true) {
// $remove_or_add_choice = readline("Do you want to remove or add a pizza to your command ? [Add / Remove / Cancel] : ");
// if ($remove_or_add_choice == "Add") {
// Recipe::showRecipes();
// echo "\n- If you want more than one, separate names with commas\n- One occurence will count as one pizza so if you want the same pizza 'x' times, type its name 'x' times separated with commas\n";
// $pizza_to_add = readline("Enter the name of the pizza you want to add : ");
// $pizza_to_add = str_replace(' ', '', $pizza_to_add);
// $pizza_name_array_to_add = explode(',', $pizza_to_add);
// foreach ($pizza_name_array_to_add as $pizza_name) {
// $command->addItem($recipes[$pizza_name], null);
// }
// echo ("\nYour command after modifications :");
// $command->getCommand();
// echo "\n";
// }
// if ($remove_or_add_choice == "Remove") {
// $pizza_to_remove = readline("Chose which pizza's number you want to remove (separate numbers with commas) : ");
// $pizza_to_remove = str_replace(' ', '', $pizza_to_remove);
// $pizza_number_array_to_remove = explode(',', $pizza_to_remove);
// foreach ($pizza_number_array_to_remove as $pizza_number) {
// $command->removeItem($pizza_number);
// }
// }
// if ($remove_or_add_choice == "Cancel") {
// break;
// }
// }
// }
// if ($modify_choice == "2") {
// $pizza_number_to_modify = readline("Chose the pizza number you want to modify : ");
// $remove_or_add_choice = readline("Do you want to remove or add an ingredient to your pizza ? [Add / Remove / Cancel] : ");
// if ($remove_or_add_choice == "Add") {
// Ingredient::showIngredients();
// echo "\n";
// $custom_recipe = new CustomRecipe($command->items[(intval($pizza_number_to_modify) - 1)]->name);
// // Overwrite Recipe index with CustomRecipe
// $command->addItem($custom_recipe, $pizza_number_to_modify);
// $ingredients_to_add = readline("Type in ingredient name you want to add to your pizza (separate names with commas) : ");
// $ingredients_to_add = str_replace(' ', '', $ingredients_to_add);
// $ingredients_to_add_array = explode(',', $ingredients_to_add);
// foreach ($ingredients_to_add_array as $ingredient) {
// $custom_recipe->addIngredientToRecipe($ingredient);
// }
// }
// if ($remove_or_add_choice == "Remove") {
// $custom_recipe = new CustomRecipe($command->items[(intval($pizza_number_to_modify) - 1)]->name);
// // Overwrite Recipe index with CustomRecipe
// $command->addItem($custom_recipe, $pizza_number_to_modify);
// $custom_recipe->showRecipe();
// echo "\n";
// $ingredients_to_remove = readline("Type in ingredient name you want to remove from your pizza (separate names with commas) : ");
// $ingredients_to_remove = str_replace(' ', '', $ingredients_to_remove);
// $ingredients_to_remove_array = explode(',', $ingredients_to_remove);
// foreach ($ingredients_to_remove_array as $ingredient) {
// $custom_recipe->removeIngredientFromRecipe($ingredient);
// }
// }
// if ($remove_or_add_choice == "Cancel") {
// break;
// }
// }
// if ($modify_choice == "3") {
// break;
// }
// }
// } else {
// echo '\nCommand sent to Mario ! Bill : ' . $command->getBill();
// break;
// }
// }
// break;
// }
// }
// if ($action == "2") {
// Ingredient::showIngredients();
// echo "\n";
// $base_list_custom_pizza = [];
// $ingredients_list_custom_pizza = [];
// $ingredients_to_add = readline("Type in ingredient name you want to add to your pizza (separate names with commas), you need at least one dough type ingredient : ");
// $ingredients_to_add = str_replace(' ', '', $ingredients_to_add);
// $ingredients_to_add_array = explode(',', $ingredients_to_add);
// foreach ($ingredients_to_add_array as $ingredient) {
// if (Ingredient::$ingredients_list[$ingredient]->type == "base") {
// $base_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// if (Ingredient::$ingredients_list[$ingredient]->type == "ingredient") {
// $ingredients_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// }
// // Create real Recipe
// $empty_recipe = new Recipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
// // to create a CustomRecipe from it
// $custom_recipe = new CustomRecipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
// $quantite_custom_pizza = readline("How many pizzas like this do you want ? : ");
// $quantite_custom_pizza = intval($quantite_custom_pizza);
// if ($quantite_custom_pizza > 0) {
// for ($i = 0; $i < $quantite_custom_pizza; $i++) {
// $command->addItem($custom_recipe, null);
// }
// }
// // then delete it
// unset(Recipe::$recipes_list[$empty_recipe->name]);
// echo "\nYour command : ";
// $command->getCommand();
// echo "\n";
// while (true) {
// $modify_choice = readline("Do you want to modify your command ? [Yes / No] : ");
// if ($modify_choice == "Yes") {
// while (true) {
// echo "1 : Remove or add a pizza to your command\n";
// echo "2 : Remove or add an ingredient to a pizza\n";
// echo "3 : Cancel\n";
// $modify_choice = readline("Your choice : ");
// echo "\n";
// if ($modify_choice == "1") {
// while (true) {
// $remove_or_add_choice = readline("Do you want to remove or add a pizza to your command ? [Add / Remove / Cancel] : ");
// if ($remove_or_add_choice == "Add") {
// Ingredient::showIngredients();
// echo "\n";
// $base_list_custom_pizza = [];
// $ingredients_list_custom_pizza = [];
// $ingredients_to_add = readline("Type in ingredient name you want to add to your pizza (separate names with commas), you need at least one dough type ingredient : ");
// $ingredients_to_add = str_replace(' ', '', $ingredients_to_add);
// $ingredients_to_add_array = explode(',', $ingredients_to_add);
// foreach ($ingredients_to_add_array as $ingredient) {
// if (Ingredient::$ingredients_list[$ingredient]->type == "base") {
// $base_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// if (Ingredient::$ingredients_list[$ingredient]->type == "ingredient")
// $ingredients_list_custom_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// // Create real Recipe
// $empty_recipe = new Recipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
// // to create a CustomRecipe from it
// $custom_recipe = new CustomRecipe("Custom pizza", $base_list_custom_pizza, $ingredients_list_custom_pizza);
// $quantite_custom_pizza = readline("How many pizzas like this do you want ? : ");
// $quantite_custom_pizza = intval($quantite_custom_pizza);
// if ($quantite_custom_pizza > 1) {
// for ($i = 0; $i < $quantite_custom_pizza; $i++) {
// $command->addItem($custom_recipe, null);
// }
// }
// // then delete it
// unset(Recipe::$recipes_list[$empty_recipe->name]);
// echo ("\nYour command after modifications :");
// $command->getCommand();
// echo "\n";
// }
// if ($remove_or_add_choice == "Remove") {
// $pizza_to_remove = readline("Chose which pizza's number you want to remove (separate numbers with commas) : ");
// $pizza_to_remove = str_replace(' ', '', $pizza_to_remove);
// $pizza_number_array_to_remove = explode(',', $pizza_to_remove);
// foreach ($pizza_number_array_to_remove as $pizza_number) {
// $command->removeItem($pizza_number);
// }
// echo ("\nYour command after modifications :");
// $command->getCommand();
// echo "\n";
// }
// if ($remove_or_add_choice == "Cancel") {
// break;
// }
// }
// }
// if ($modify_choice == "2") {
// $pizza_number_to_modify = readline("Chose the pizza number you want to modify : ");
// $remove_or_add_choice = readline("Do you want to remove or add an ingredient to your pizza ? [Add / Remove / Cancel] : ");
// $pizza_to_modify = $command->items[(intval($pizza_number_to_modify) - 1)];
// if ($remove_or_add_choice == "Add") {
// Ingredient::showIngredients();
// echo "\n";
// $ingredients_to_add = readline("Type in ingredient name you want to add to your pizza (separate names with commas) : ");
// $ingredients_to_add = str_replace(' ', '', $ingredients_to_add);
// $ingredients_to_add_array = explode(',', $ingredients_to_add);
// foreach ($ingredients_to_add_array as $ingredient) {
// $pizza_to_modify->addIngredientToRecipe($ingredient);
// }
// echo ("\nYour command after modifications :");
// $command->getCommand();
// echo "\n";
// }
// if ($remove_or_add_choice == "Remove") {
// $pizza_to_modify->showRecipe();
// echo "\n";
// $ingredients_to_remove = readline("Type in ingredient name you want to remove from your pizza (separate names with commas) : ");
// $ingredients_to_remove = str_replace(' ', '', $ingredients_to_remove);
// $ingredients_to_remove_array = explode(',', $ingredients_to_remove);
// $pizza_to_modify = $command->items[(intval($pizza_number_to_modify) - 1)];
// foreach ($ingredients_to_remove_array as $ingredient) {
// $pizza_to_modify->removeIngredientFromRecipe($ingredient);
// }
// echo ("\nYour command after modifications :");
// $command->getCommand();
// echo "\n";
// }
// if ($remove_or_add_choice == "Cancel") {
// break;
// }
// }
// if ($modify_choice == "3") {
// break;
// }
// }
// } else {
// echo "\n";
// echo 'Command sent to Mario ! Bill : ' . $command->getBill();
// break;
// }
// }
// }
// }
// //ADMIN PART:
// if ($usertype == 2) {
// echo "Your choice : Admin\n\n";
// echo "Connection : \n";
// //ADMIN connection
// $testpseudo = "";
// $testpassword = "";
// $config = parse_ini_file("src/pizzapp/Aùdmin/config.ini");
// $testpseudo = readline("User : ");
// while ($testpseudo != $config["pseudo"]) {
// echo ("Wrong pseudo\n\n");
// $testpseudo = readline("User : ");
// }
// $testpassword = readline("Password : ");
// while ($testpassword != $config["password"]) {
// echo ("Wrong password\n\n");
// $testpassword = readline("Password : ");
// }
// echo "\nHello Mario !";
// $manager = new Manager();
// $manager->showIngredients();
// while (true) {
// //SELECTION Choice
// echo "ADMIN Choice :";
// echo "\n1 : View orders";
// echo "\n2 : Manage recipes";
// echo "\n3 : Manage stock";
// echo "\n4 : Exit\n";
// $userchoice = readline("Which choice : ");
// if ($userchoice == "1") {
// $commands = $manager->showCommands();
// foreach ($commands as $command) {
// print_r($command);
// }
// }
// if ($userchoice == "2") {
// while (true) {
// echo "\n1 : List all recipes";
// echo "\n2 : Add new recipe";
// echo "\n3 : Remove recipe";
// echo "\n4 : Change margin";
// echo "\n5 : Cancel";
// echo ("\n");
// $userchoice = readline("Your choice : ");
// if ($userchoice == "1") {
// Recipe::showRecipes();
// }
// if ($userchoice == "2") {
// echo ("\n");
// $recipe_name = readline("Recipe name you want to add : ");
// $manager->showIngredients();
// echo ("\n");
// $ingredients = readline("Type in ingredient names (separate with commas) : ");
// $ingredients = str_replace(' ', '', $ingredients);
// $ingredients_array = explode(',', $ingredients);
// $ingredients_array = array_filter($ingredients_array);
// foreach ($ingredients_array as $ingredient) {
// if (Ingredient::$ingredients_list[$ingredient]->type == "base") {
// $base_list_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// if (Ingredient::$ingredients_list[$ingredient]->type == "ingredient") {
// $ingredients_list_pizza[$ingredient] = Ingredient::$ingredients_list[$ingredient];
// }
// }
// $recipe = new Recipe($recipe_name, $base_list_pizza, $ingredients_list_pizza);
// echo "\nYour recipe $recipe_name has been created !";
// Recipe::showRecipes();
// }
// if ($userchoice == "3") {
// Recipe::showRecipes();
// echo ("\n");
// $recipe_name = readline("Recipe name you want to remove : ");
// Recipe::removeRecipe($recipe_name);
// Recipe::showRecipes();
// echo "\nYour recipe has been removed successfully";
// }
// if ($userchoice == "4") {
// echo "Current margin : ";
// echo Manager::$margin;
// echo "\n";
// $new_margin = readline("Type in your new margin : ");
// $manager->changeMargin($new_margin);
// echo "\nNew margin : ";
// echo Manager::$margin;
// }
// if ($userchoice == "5") {
// break;
// }
// }
// }
// if ($userchoice == "3") {
// while (true) {
// echo "\n1 : List stock";
// echo "\n2 : Add new ingredients";
// echo "\n3 : Remove ingredients";
// echo "\n4 : Manage the stock of an ingredient ";
// echo "\n5 : Change ingredient's prices";
// echo "\n6 : Exit\n";
// $userchoice = readline("Which choice : ");
// if ($userchoice == "1") {
// $manager->showIngredients();
// }
// if ($userchoice == "2") {
// echo "\n";
// $ingredient_name = readline("Ingredient name you want to add : ");
// echo "\n";
// $ingredient_quantity = readline("How many do you want to add ? : ");
// echo "\n";
// $ingredient_price = readline("How much does it cost per unit ? (example : 0.99) : ");
// echo "\n";
// $ingredient_type = readline("What type is it ? [base / ingredient] : ");
// $new_ingredient = new Ingredient($ingredient_name, intval($ingredient_quantity), $ingredient_price, $ingredient_type);
// $manager->addIngredientToStock($new_ingredient);
// $manager->showIngredients();
// echo "\nYour ingredient has been added successfully";
// }
// if ($userchoice == "3") {
// $manager->showIngredients();
// echo "\n";
// $ingredient_name = readline("Ingredient name you want to remove : ");
// echo "\n";
// $manager->removeIngredientFromStock(Ingredient::$ingredients_list[$ingredient_name]);
// unset(Ingredient::$ingredients_list[$ingredient_name]);
// $manager->showIngredients();
// echo "\nYour ingredient has been removed successfully";
// }
// if ($userchoice == "4") {
// $manager->showIngredients();
// echo "\n";
// $ingredient_name = readline("Ingredient name you want to modify quantity : ");
// echo "\n";
// $ingredient_quantity = readline("Enter its new quantity : ");
// Ingredient::$ingredients_list[$ingredient_name]->quantity = $ingredient_quantity;
// $manager->showIngredients();
// }
// if ($userchoice == "5") {
// $manager->showIngredients();
// echo "\n";
// $ingredient_name = readline("Ingredient name you want to modify quantity : ");
// echo "\n";
// $ingredient_price = readline("Enter its new price : ");
// Ingredient::$ingredients_list[$ingredient_name]->price = $ingredient_price;
// }
// if ($userchoice == "6") {
// break;
// }
// }
// }
// if ($userchoice == "4") {
// break;
// }
// }
// }
// if ($usertype == "3") {
// break;
// }
// }
#endregion