示例#1
0
文件: minim.php 项目: andyhd/minim
/**
 * Syntax sugar function - provides interface to singleton instances of Minim
 * class and lazy loaded plugins.
 * @param string $plugin (optional) Name of plugin to access
 * @return Reference to singleton instance of Minim class or specified plugin.
 */
function &minim($plugin = NULL)
{
    static $instance;
    if (!$instance) {
        $instance = new Minim();
    }
    if (is_null($plugin)) {
        return $instance;
    }
    return $instance->get_plugin($plugin);
}
示例#2
0
文件: minim.php 项目: andyhd/minim
 function test_minim_get_null_plugin()
 {
     $minim = new Minim();
     try {
         $minim->get_plugin(NULL);
     } catch (Minim_Exception $me) {
         // test passes
         return;
     } catch (Exception $e) {
         $this->fail('Caught unexpected exception: ' . $e);
     }
     $this->fail('Expected Minim_Exception');
 }