mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 17:52:25 +01:00
40 lines
665 B
PHP
40 lines
665 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Structural\Facade;
|
|
|
|
class Facade
|
|
{
|
|
/**
|
|
* @var OsInterface
|
|
*/
|
|
private $os;
|
|
|
|
/**
|
|
* @var BiosInterface
|
|
*/
|
|
private $bios;
|
|
|
|
/**
|
|
* @param BiosInterface $bios
|
|
* @param OsInterface $os
|
|
*/
|
|
public function __construct(BiosInterface $bios, OsInterface $os)
|
|
{
|
|
$this->bios = $bios;
|
|
$this->os = $os;
|
|
}
|
|
|
|
public function turnOn()
|
|
{
|
|
$this->bios->execute();
|
|
$this->bios->waitForKeyPress();
|
|
$this->bios->launch($this->os);
|
|
}
|
|
|
|
public function turnOff()
|
|
{
|
|
$this->os->halt();
|
|
$this->bios->powerDown();
|
|
}
|
|
}
|