kristuff /
patabase
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /** |
||
| 4 | * ___ _ _ |
||
| 5 | * | _ \__ _| |_ __ _| |__ __ _ ___ ___ |
||
| 6 | * | _/ _` | _/ _` | '_ \/ _` (_-</ -_) |
||
| 7 | * |_| \__,_|\__\__,_|_.__/\__,_/__/\___| |
||
| 8 | * |
||
| 9 | * This file is part of Kristuff\Patabase. |
||
| 10 | * (c) Kristuff <[email protected]> |
||
| 11 | * |
||
| 12 | * For the full copyright and license information, please view the LICENSE |
||
| 13 | * file that was distributed with this source code. |
||
| 14 | * |
||
| 15 | * @version 1.0.1 |
||
| 16 | * @copyright 2017-2022 Christophe Buliard |
||
| 17 | */ |
||
| 18 | |||
| 19 | namespace Kristuff\Patabase\Driver; |
||
| 20 | |||
| 21 | use Kristuff\Patabase\Driver; |
||
| 22 | use Kristuff\Patabase\Exception; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Class DriverFactory |
||
| 26 | */ |
||
| 27 | class DriverFactory |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * Get Server/Database driver from given settings |
||
| 31 | * |
||
| 32 | * @access public |
||
| 33 | * @param array $settings The connection settings |
||
| 34 | * @param bool $isServerConnection True for Server connection, default is false |
||
| 35 | * |
||
| 36 | * @return MysqlDriver|PostgresDriver|SqliteDriver |
||
|
0 ignored issues
–
show
The type
Kristuff\Patabase\Driver\MysqlDriver was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
The type
Kristuff\Patabase\Driver\PostgresDriver was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 37 | * @throw Exception\InvalidArgException |
||
| 38 | */ |
||
| 39 | public static function getInstance(array $settings, $isServerConnection = false) |
||
| 40 | { |
||
| 41 | if (! isset($settings['driver'])) { |
||
| 42 | throw new Exception\MissingArgException('You must define a driver'); |
||
| 43 | } |
||
| 44 | |||
| 45 | // get driver |
||
| 46 | switch ($settings['driver']) { |
||
| 47 | |||
| 48 | case 'sqlite': |
||
| 49 | return new Driver\Sqlite\SqliteDriver($settings); |
||
|
0 ignored issues
–
show
|
|||
| 50 | |||
| 51 | case 'mysql': |
||
| 52 | return new Driver\Mysql\MysqlDriver($settings, $isServerConnection); |
||
|
0 ignored issues
–
show
|
|||
| 53 | |||
| 54 | case 'pgsql': |
||
| 55 | return new Driver\Postgres\PostgresDriver($settings, $isServerConnection); |
||
|
0 ignored issues
–
show
|
|||
| 56 | |||
| 57 | default: |
||
| 58 | throw new Exception\InvalidArgException('The specified driver is not supported'); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths