| @@ -1,0 +1,19 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace Templately; | |
| 4 | + | |
| 5 | +class Base { | |
| 6 | + protected static $_instance = null; | |
| 7 | + /** | |
| 8 | + * Get Instance of Called Class | |
| 9 | + * | |
| 10 | + * @return void | |
| 11 | + */ | |
| 12 | + public static function get_instance(){ | |
| 13 | + if( static::$_instance === null ) { | |
| 14 | + $class = get_called_class(); | |
| 15 | + static::$_instance = new $class; | |
| 16 | + } | |
| 17 | + return static::$_instance; | |
| 18 | + } | |
| 19 | +} | |