Example #1
0
 /**
  * Create SSql instance and connect database with passed config.
  *
  * @param $config
  * @return SSql
  * @throws \RuntimeException when the parameter, config is not array type
  */
 public static function connect($config)
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
         if (is_array($config)) {
             self::$instance->setConfigFromArray($config);
         } else {
             throw new RuntimeException('config should be an array');
         }
     }
     return self::$instance;
 }