Created
May 30, 2011 10:04
-
-
Save peterudo/998678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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