Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active Apr 30, 2021
Embed
What would you like to do?
<?
interface ElectronicDevice {
//...
}
interface PhoneCommunication {
//...
}
final class Ipad implements ElectronicDevice {
private $operatingSystem;
private $battery;
public function __construct(Battery $battery, OperatingSystem $ios) {
$this->operatingSystem = $ios;
$this->battery = $battery;
}
}
final class Iphone implements ElectronicDevice, PhoneCommunication {
private $phoneModule;
private $operatingSystem;
private $battery;
public function __construct(Battery $battery, OperatingSystem $ios, PhoneModule $phoneModule) {
$this->phoneModule = $phoneModule;
$this->operatingSystem = $ios;
$this->battery = $battery;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment