-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (28 loc) · 856 Bytes
/
index.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
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use App\Commands\Lamp\OffCommand;
use App\Commands\Lamp\OnCommand;
use App\Commands\Menu\CloseDocumentCommand;
use App\Commands\Menu\OpenDocumentCommand;
use App\Commands\Menu\SaveDocumentCommand;
use App\Document;
use App\Lamp;
use App\Menu;
use App\MySwitch;
// Ejemplo de la lámpara
$lamp = new Lamp();
$onCommand = new OnCommand($lamp);
$offCommand = new OffCommand($lamp);
$switch = new MySwitch($onCommand, $offCommand);
$switch->on();
$switch->off();
// Ejemplo del documento
$document = new Document();
$openCommand = new OpenDocumentCommand($document);
$saveCommand = new SaveDocumentCommand($document);
$closeCommand =new CloseDocumentCommand($document);
$menu = new Menu($openCommand, $saveCommand, $closeCommand);
$menu->open();
$menu->save();
$menu->close();