File DatabaseSqlite.php
has 614 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
DatabaseSqlite
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseSqlite extends Database {
/** @var string|null Directory for SQLite database files listed under their DB name */
protected $dbDir;
/** @var string|null Explicit path for the SQLite database file */
protected $dbPath;
Method duplicateTableStructure
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function duplicateTableStructure(
$oldName, $newName, $temporary = false, $fname = __METHOD__
) {
$query = new Query(
"SELECT sql FROM sqlite_master WHERE tbl_name=" .
Function open
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
$this->close( __METHOD__ );
// Note that for SQLite, $server, $user, and $pass are ignored
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method open
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
$this->close( __METHOD__ );
// Note that for SQLite, $server, $user, and $pass are ignored
Function duplicateTableStructure
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function duplicateTableStructure(
$oldName, $newName, $temporary = false, $fname = __METHOD__
) {
$query = new Query(
"SELECT sql FROM sqlite_master WHERE tbl_name=" .
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method open
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
Function listTables
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function listTables( $prefix = null, $fname = __METHOD__ ) {
$query = new Query(
"SELECT name FROM sqlite_master WHERE type = 'table'",
self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
'SELECT'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $this->getBindingHandle()->quote( (string)$s );