crate /
crate-dbal
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * Licensed to CRATE Technology GmbH("Crate") under one or more contributor |
||||
| 5 | * license agreements. See the NOTICE file distributed with this work for |
||||
| 6 | * additional information regarding copyright ownership. Crate licenses |
||||
| 7 | * this file to you under the Apache License, Version 2.0 (the "License"); |
||||
| 8 | * you may not use this file except in compliance with the License. You may |
||||
| 9 | * obtain a copy of the License at |
||||
| 10 | * |
||||
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||||
| 12 | * |
||||
| 13 | * Unless required by applicable law or agreed to in writing, software |
||||
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
||||
| 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
||||
| 16 | * License for the specific language governing permissions and limitations |
||||
| 17 | * under the License. |
||||
| 18 | * |
||||
| 19 | * However, if you have executed another commercial license agreement |
||||
| 20 | * with Crate these terms will supersede the license and you may use the |
||||
| 21 | * software solely pursuant to the terms of the relevant commercial agreement. |
||||
| 22 | */ |
||||
| 23 | |||||
| 24 | namespace Crate\DBAL\Driver\PDOCrate; |
||||
| 25 | |||||
| 26 | use Crate\DBAL\Platforms\CratePlatform; |
||||
| 27 | use Crate\DBAL\Platforms\CratePlatform1; |
||||
| 28 | use Crate\DBAL\Platforms\CratePlatform4; |
||||
| 29 | use Crate\DBAL\Schema\CrateSchemaManager; |
||||
| 30 | use Doctrine\DBAL\Connection; |
||||
| 31 | use Doctrine\DBAL\Platforms\AbstractPlatform; |
||||
| 32 | use Doctrine\DBAL\Schema\AbstractSchemaManager; |
||||
| 33 | use Doctrine\DBAL\VersionAwarePlatformDriver; |
||||
| 34 | use SensitiveParameter; |
||||
|
0 ignored issues
–
show
|
|||||
| 35 | |||||
| 36 | class Driver implements VersionAwarePlatformDriver |
||||
|
0 ignored issues
–
show
The interface
Doctrine\DBAL\VersionAwarePlatformDriver has been deprecated: All drivers will have to be aware of the server version in the next major release.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This interface has been deprecated. The supplier of the interface has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead. Loading history...
|
|||||
| 37 | { |
||||
| 38 | public const VERSION = '4.0.3'; |
||||
| 39 | public const NAME = 'crate'; |
||||
| 40 | |||||
| 41 | private const VERSION_057 = '0.57.0'; |
||||
| 42 | private const VERSION_4 = '4.0.0'; |
||||
| 43 | |||||
| 44 | /** |
||||
| 45 | * {@inheritDoc} |
||||
| 46 | * @return PDOConnection The database connection. |
||||
| 47 | */ |
||||
| 48 | 22 | public function connect( |
|||
| 49 | #[SensitiveParameter] |
||||
| 50 | array $params |
||||
| 51 | ): PDOConnection { |
||||
| 52 | 22 | $username = $params['user'] ?? null; |
|||
| 53 | 22 | $password = $params['password'] ?? null; |
|||
| 54 | 22 | $driverOptions = $params['driver_options'] ?? []; |
|||
| 55 | 22 | return new PDOConnection($this->constructPdoDsn($params), $username, $password, $driverOptions); |
|||
| 56 | } |
||||
| 57 | |||||
| 58 | /** |
||||
| 59 | * Constructs the Crate PDO DSN. |
||||
| 60 | * |
||||
| 61 | * @return string The DSN. |
||||
| 62 | */ |
||||
| 63 | 22 | private function constructPdoDsn(array $params): string |
|||
| 64 | { |
||||
| 65 | 22 | $dsn = self::NAME . ':'; |
|||
| 66 | 22 | if (isset($params['host']) && $params['host'] != '') { |
|||
| 67 | 22 | $dsn .= $params['host']; |
|||
| 68 | } else { |
||||
| 69 | $dsn .= 'localhost'; |
||||
| 70 | } |
||||
| 71 | 22 | $dsn .= ':' . (isset($params['port']) ? $params['port'] : '4200'); |
|||
| 72 | |||||
| 73 | 22 | return $dsn; |
|||
| 74 | } |
||||
| 75 | |||||
| 76 | /** |
||||
| 77 | * {@inheritDoc} |
||||
| 78 | */ |
||||
| 79 | 6 | public function getDatabasePlatform(): AbstractPlatform |
|||
| 80 | { |
||||
| 81 | 6 | return new CratePlatform4(); |
|||
| 82 | } |
||||
| 83 | |||||
| 84 | /** |
||||
| 85 | * {@inheritDoc} |
||||
| 86 | */ |
||||
| 87 | 96 | public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager |
|||
| 88 | { |
||||
| 89 | // Added by Doctrine 3. |
||||
| 90 | 96 | return new CrateSchemaManager($conn, $platform); |
|||
| 91 | } |
||||
| 92 | |||||
| 93 | /** |
||||
| 94 | * {@inheritDoc} |
||||
| 95 | */ |
||||
| 96 | public function getName(): string |
||||
| 97 | { |
||||
| 98 | return self::NAME; |
||||
| 99 | } |
||||
| 100 | |||||
| 101 | /** |
||||
| 102 | * {@inheritDoc} |
||||
| 103 | */ |
||||
| 104 | public function getDatabase(Connection $conn): string|null |
||||
|
0 ignored issues
–
show
The parameter
$conn is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 105 | { |
||||
| 106 | return null; |
||||
| 107 | } |
||||
| 108 | |||||
| 109 | /** |
||||
| 110 | * {@inheritDoc} |
||||
| 111 | */ |
||||
| 112 | 240 | public function createDatabasePlatformForVersion($version): AbstractPlatform |
|||
| 113 | { |
||||
| 114 | 240 | if (version_compare($version, self::VERSION_057, "<")) { |
|||
| 115 | 2 | return new CratePlatform(); |
|||
| 116 | 238 | } elseif (version_compare($version, self::VERSION_4, "<")) { |
|||
| 117 | 2 | return new CratePlatform1(); |
|||
| 118 | } else { |
||||
| 119 | 236 | return new CratePlatform4(); |
|||
| 120 | } |
||||
| 121 | } |
||||
| 122 | |||||
| 123 | /** |
||||
| 124 | * {@inheritDoc} |
||||
| 125 | */ |
||||
| 126 | 2 | public function getExceptionConverter(): ExceptionConverter |
|||
| 127 | { |
||||
| 128 | // Added by Doctrine 3. |
||||
| 129 | 2 | return new ExceptionConverter(); |
|||
| 130 | } |
||||
| 131 | } |
||||
| 132 |
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