mainInstance.php 949 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace MGModule\DNSManager2\mgLibs\process;
  3. use MGModule\DNSManager2 as main;
  4. use MGModule\DNSManager2\mgLibs\exceptions\system as SystemException;
  5. /**
  6. * Description of mainController
  7. *
  8. * @author Michal Czech <michael@modulesgarden.com>
  9. */
  10. class mainInstance {
  11. /**
  12. *
  13. * @var abstractMainDriver
  14. */
  15. static private $_instanceName;
  16. public static function setInstanceName($instance){
  17. self::$_instanceName = $instance;
  18. }
  19. public static function __callStatic($name, $arguments) {
  20. return call_user_func(array(self::$_instanceName,$name),$arguments);
  21. }
  22. /**
  23. *
  24. * @return main\mgLibs\process\abstractMainDriver
  25. * @throws exceptions\system
  26. */
  27. static function I(){
  28. if(empty(self::$_instanceName))
  29. {
  30. throw new SystemException('Instance is not set');
  31. }
  32. return call_user_func(array(self::$_instanceName,'I'));
  33. }
  34. }