/** * Returns a reference to the global JCli object, only creating it if it * doesn't already exist. * * This method must be invoked as: $cli = JCli::getInstance(); * * @return JCli A JCli object * * @since 11.1 */ public static function &getInstance() { // Only create the object if it doesn't exist. if (empty(self::$instance)) { self::$instance = new JCli(); } return self::$instance; }
/** * Returns a reference to the global JCli object, only creating it if it * doesn't already exist. * * This method must be invoked as: $cli = JCli::getInstance(); * * @return JCli A JCli object * * @since 11.1 */ public static function &getInstance($name = null) { // Only create the object if it doesn't exist. if (empty(self::$instance)) { if (class_exists($name) && $name instanceof JCli) { self::$instance = new $name(); } else { self::$instance = new JCli(); } } return self::$instance; }
/** * Returns a reference to the global JCli object, only creating it if it * doesn't already exist. * * This method must be invoked as: $cli = JCli::getInstance(); * * @param string $name The name of the JCli class to instantiate. * * @return JCli A JCli object * * @since 11.1 */ public static function & getInstance($name = null) { // Only create the object if it doesn't exist. if (empty(self::$instance)) { if (class_exists($name) && (is_subclass_of($name, 'JCli'))) { self::$instance = new $name; } else { self::$instance = new JCli; } } return self::$instance; }