| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | class Connection extends C |
||
| 26 | { |
||
| 27 | |||
| 28 | /** |
||
| 29 | * 初始化 |
||
| 30 | * |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | public function init() |
||
| 34 | { |
||
| 35 | $this->schemaMap['imysql'] = Schema::className(); |
||
| 36 | $this->commandMap['imysql'] = Command::className(); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * 创建 PDO 对象 |
||
| 41 | * |
||
| 42 | * @return \PDO |
||
| 43 | */ |
||
| 44 | public function createPdoInstance() |
||
| 45 | { |
||
| 46 | $driver = $this->getDriverName(); |
||
| 47 | if (in_array($driver, ['imysql'])) { |
||
| 48 | $pdoClass = PDO::className(); |
||
| 49 | return new $pdoClass($this->dsn, $this->username, $this->password, $this->attributes); |
||
| 50 | } else { |
||
| 51 | return parent::createPdoInstance(); |
||
| 52 | } |
||
| 55 |