Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
18 | 21 | public function connect() |
|
19 | { |
||
20 | $params = [ |
||
21 | 21 | 'dbname' => $this->config->dbname, |
|
22 | 21 | 'user' => $this->config->username, |
|
23 | 21 | 'password' => $this->config->password, |
|
24 | 21 | 'host' => $this->config->host, |
|
25 | 21 | 'port' => $this->config->port, |
|
26 | 21 | 'driver' => 'pdo_mysql', |
|
27 | 21 | 'charset' => 'utf8' |
|
28 | ]; |
||
29 | |||
30 | 21 | $config = new Configuration([ |
|
|
|||
31 | 21 | \PDO::ATTR_PERSISTENT => true, |
|
32 | \PDO::ATTR_EMULATE_PREPARES => false, |
||
33 | 21 | \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, |
|
34 | \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true |
||
35 | ]); |
||
36 | |||
37 | 21 | $this->connection = DriverManager::getConnection($params, $config); |
|
38 | 21 | $this->logger->debug(get_class($this) . " connect."); |
|
39 | } |
||
41 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.