/** * Allow only one instance of this class exist * for a single request */ public static function instance() { $called = get_called_class(); if (self::$instance instanceof self) { return self::$instance; } return self::$instance = new self(); }