Created
March 17, 2010 00:49
-
-
Save AdrianRossouw/334751 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
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