<?php

namespace MGModule\DNSManager2\mgLibs\process;
use MGModule\DNSManager2 as main;
use MGModule\DNSManager2\mgLibs\exceptions\system as SystemException;

/**
 * Description of mainController
 *
 * @author Michal Czech <michael@modulesgarden.com>
 */
class mainInstance {
    /**
     *
     * @var abstractMainDriver
     */
    static private $_instanceName;

    public static function setInstanceName($instance){
        self::$_instanceName = $instance;
    }
    
    public static function __callStatic($name, $arguments) {
        return call_user_func(array(self::$_instanceName,$name),$arguments);
    }

    /**
     * 
     * @return main\mgLibs\process\abstractMainDriver
     * @throws exceptions\system
     */
    static function I(){
        if(empty(self::$_instanceName))
        {
            throw new SystemException('Instance is not set');
        }
        return call_user_func(array(self::$_instanceName,'I'));
    }
}
