/** * A reference accessor the static singleton instantiation of the adapter * for the user agent, constructing the adapter with the user agent string * if the adapter has not already been instantiated. * * @return User_Agent_Adapter_Interface */ public static function &adapter() { if (self::$_adapter === null) { if (($ua = User_Agent::get()) !== false) { require_once strtolower(Config::get('user_agent', 'adapter')) . '.class.php'; $adapter_class = Config::get('user_agent', 'adapter'); self::$_adapter = new $adapter_class($ua); } else { require_once 'user_agent_empty_adapter.class.php'; self::$_adapter = new User_Agent_Empty_Adapter(); } } return self::$_adapter; }