Skip to content

Instantly share code, notes, and snippets.

@AdrianRossouw
Created March 17, 2010 00:49
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 AdrianRossouw/334751 to your computer and use it in GitHub Desktop.
Save AdrianRossouw/334751 to your computer and use it in GitHub Desktop.
class provisionService {
}
class provisionService_null extends provisionService {
function __get($name) {
return false;
}
function __call($name, $args) {
return false;
}
}
provision_service('null', new provisionService_null());
function provision_service($type, $object = null) {
static $instances = null;
if (is_object($object)) {
$instances[$type] = $object;
}
if (isset($instances[$type])) {
return $instances[$type];
}
return $instances['null'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment