Beispiel #1
0
/**
 * 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);
}
Beispiel #2
0
 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');
 }