-
Notifications
You must be signed in to change notification settings - Fork 0
/
php.php
38 lines (32 loc) · 785 Bytes
/
php.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
<?php
// Facade: Proporciona una interfaz simplificada a un conjunto complejo de interfaces en un subsistema.
class SubsystemA
{
public function operationA(): string
{
return "SubsystemA Operation";
}
}
class SubsystemB
{
public function operationB(): string
{
return "SubsystemB Operation";
}
}
class Facade
{
private $subsystemA;
private $subsystemB;
public function __construct()
{
$this->subsystemA = new SubsystemA();
$this->subsystemB = new SubsystemB();
}
public function operation(): string
{
return $this->subsystemA->operationA() . ", " . $this->subsystemB->operationB();
}
}
$facade = new Facade();
echo $facade->operation(); // SubsystemA Operation, SubsystemB Operation