Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- NAMESPACE ILLI\Bug;
- INTERFACE Foo {}
- CLASS Instance IMPLEMENTS Foo
- {
- private static $instances = [];
- public static function getInstance()
- {
- $thread = get_called_class();
- if(isset(self::$instances[$thread]))
- return self::$instances[$thread];
- self::$instances[$thread] = new $thread;
- return self::$instances[$thread]->__staticconstruct();
- }
- /*
- use tInstance
- {
- tInstance_get as public getInstance;
- }
- */
- private static $counter = 0;
- private function __construct()
- {
- }
- private function __staticconstruct()
- {
- var_dump(self::getInstance() instanceOf Foo);
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement