-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.php
More file actions
52 lines (46 loc) · 1.58 KB
/
run.php
File metadata and controls
52 lines (46 loc) · 1.58 KB
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
<?php
/**
* run.php
*
* User: hauke
* Date: 22.02.12 21:48
*/
include 'class/Autoloader.php';
Autoloader::register();
$eventLoop = new EventLoop();
$pastaPan = new Pan($eventLoop);
$saucePan = new Pan($eventLoop);
$water = new Water();
$plate = new PlateOfSpaghettiWithSauce();
$pastaPan->fill($water);
echo "pastaPan: Starting to boil water\n";
$pastaPan->warm(10, function() use ($pastaPan, $plate, $water) {
echo "pastaPan: Water is boiling\n";
$pastaPan->fill(new Spaghetti());
echo "pastaPan: Starting to boil spaghetti\n";
$pastaPan->warm(8, function() use ($pastaPan, $plate, $water) {
echo "pastaPan: Spaghetti is ready\n";
$pastaPan->remove($water);
$plate->addContentsOf($pastaPan);
});
});
$eventLoop->executeLater(7, function() use ($plate, $eventLoop) {
$saucePan = new Pan($eventLoop);
$saucePan->fill(new OliveOil());
echo "saucePan: Starting to warm olive oil\n";
$saucePan->warm(2, function() use ($saucePan, $plate) {
echo "saucePan: Olive oil is warm\n";
$saucePan->fill(new Mirepoix());
echo "saucePan: Starting to cook the Mirepoix\n";
$saucePan->warm(5, function() use ($saucePan, $plate) {
echo "saucePan: Mirepoix is ready to welcome tomato\n";
$saucePan->fill(new Tomato());
echo "saucePan: Starting to cook tomato\n";
$saucePan->warm(4, function() use ($saucePan, $plate) {
echo "saucePan: Tomato sauce is ready\n";
$plate->addContentsOf($saucePan);
});
});
});
});
$eventLoop->start();