Skip to content

Instantly share code, notes, and snippets.

@peterudo
Created May 30, 2011 10:04
Show Gist options
  • Save peterudo/998678 to your computer and use it in GitHub Desktop.
Save peterudo/998678 to your computer and use it in GitHub Desktop.
<?php
abstract class A {
protected function isCacheable($object) {
if (!is_object($object) || !($object instanceof CacheableInterface)) {
return false;
}
return true;
}
public function store($object) {
if (!$this->isCacheable($object)) {
return false;
}
$this->storeObject($object);
}
abstract protected function storeObject($object);
}
class B extends A {
protected function storeObject($object) {
// Do something else
}
}
class C extends A {
protected function storeObject($object) {
// Do something else
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment