示例#1
0
 public function __construct(string $driver = NULL)
 {
     parent::__construct();
     if (!defined('static::driver')) {
         throw new UndefinedConstException('[const driver] is required to use the [Driver Ability]!');
     }
     nullCoalesce($driver, $this->config['driver'] ?? NULL);
     $this->selectedDriverName = $driver;
     Support::driver(static::driver['options'], $driver);
     if (!isset(static::driver['namespace'])) {
         $this->driver = uselib($driver);
     } else {
         $this->driver = uselib(suffix(static::driver['namespace'], '\\') . $driver . 'Driver');
     }
     if (isset(static::driver['construct'])) {
         $construct = static::driver['construct'];
         $this->{$construct}();
     }
 }