Skip to content

Instantly share code, notes, and snippets.

@eriktorsner
Created May 24, 2017 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eriktorsner/a50347afc2bb53d1869591b978132c54 to your computer and use it in GitHub Desktop.
Save eriktorsner/a50347afc2bb53d1869591b978132c54 to your computer and use it in GitHub Desktop.
<?php
// Solution 1. Let ElectricCar handle unplugging itself
class ElectricCar extends Car
{
...
public function start()
{
$this->unplug();
parent::start();
}
...
}
// Solution 2. Change the interface
class Car
{
public function BeforeStart()
{
}
public function start()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment