Skip to content

Instantly share code, notes, and snippets.

@weburnit
Last active October 9, 2015 04:58
Show Gist options
  • Save weburnit/f2049878190f73d91019 to your computer and use it in GitHub Desktop.
Save weburnit/f2049878190f73d91019 to your computer and use it in GitHub Desktop.
Delegation
<?php
class OfficeDelegation implement BackupPowerDelegateInteface, PrinterDelegateInterface
{
public function duringOfficeLogic()
{
if($this->powerIsOff()){
$backupPower = new BackupPowerHandler();
$backupPower->setDelegate($this);
}
}
public function successTurnonPowerBackup()
{
$this->turnOnPrinter();
}
/**
* Implement delegation handler for BackupPowerDelegateInteface
*/
public function errorTurnonPowerBackup()
{
//Doing something on failure
}
/**
* Implement delegation handler for BackupPowerDelegateInteface
* @var DocumentInterface[]
*/
public function finishedPrintDocuments($documents)
{
//Doing something on failure
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment