Showing 84 of 1,039 total issues
Method fieldType
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fieldType($result_object,$index,$which_connection='')
{
if ($which_connection == '') {
$which_connection = $this->default_db;
}
Method addConnection
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
{
if (empty($type)) {
return false;
} elseif (strtolower($type) == 'postgres9') {
Method normalizeRename
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function normalizeRename($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
{
$current = $this->connection->detailedDefinition($this->name);
$recase_columns = array();
foreach ($this->columns as $col_name => $definition) {
Method readRoutes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readRoutes()
{
// routes begin with method
$this->__method = $this->detectMethod();
Function addConnection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
{
if (empty($type)) {
return false;
} elseif (strtolower($type) == 'postgres9') {
- 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 writeLog
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function writeLog($message, array $context, $intLevel)
{
$file = $this->getLogLocation($intLevel);
$verboseDebug = $this->verboseDebugging();
Method arrayToSQL
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function arrayToSQL($definition, $dbms)
{
$sql = '';
$type = $definition['type'];
if (isset($this->meta_types[strtoupper($type)])) {
Method log
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function log($level, $message, array $context = array())
{
switch ($this->normalizeLevel($level)) {
case \Psr\Log\LogLevel::EMERGENCY:
$this->emergency($message, $context);
Method log
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function log($level, $message, array $context = array())
{
switch ($this->normalizeLevel($level)) {
case 'emergency':
$this->emergency($message, $context);
Method toOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toOptions($selected=0, $id_as_label=false)
{
if (count($this->unique) != 1) {
return '';
}
Consider simplifying this complex logical expression. Open
if (($argc < 3 || $argc > 4) || ($argc == 3 && $argv[1] != "--new" && $argv[1] != '--new-view') || ($argc == 4 && $argv[1] != '--update')) {
echo "Create new Model: php BasicModel.php --new <Model Name>\n";
echo "Create new View Model: php BasicModel.php --new-view <Model Name>\n";
echo "Update Table Structure: php BasicModel.php --update <Database name> <Subclass Filename>\n";
echo "Generate markdown documentation: php BasicModel.php --doc <Model Filename(s)>\n";
Function getDrivers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static public function getDrivers()
{
$ret = array();
if (extension_loaded('mysqli')) {
$ret['MYSQLI'] = 'MySQLi';
- 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
Function log
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function log($level, $message, array $context = array())
{
switch ($this->normalizeLevel($level)) {
case \Psr\Log\LogLevel::EMERGENCY:
$this->emergency($message, $context);
- 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
Function log
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function log($level, $message, array $context = array())
{
switch ($this->normalizeLevel($level)) {
case 'emergency':
$this->emergency($message, $context);
- 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
Function columnsDoc
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function columnsDoc()
{
$ret = str_pad('Name', 25, ' ') . '|' . str_pad('Type', 15, ' ') . '|Info' . "\n";
$ret .= str_repeat('-', 25) . '|' . str_repeat('-', 15) . '|' . str_repeat('-', 10) . "\n";
foreach ($this->columns as $name => $info) {
- 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
Function toOptions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function toOptions($selected=0, $id_as_label=false)
{
if (count($this->unique) != 1) {
return '';
}
- 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 addConnection
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addConnection($server,$type,$database,$username,$password='',$persistent=false,$new=false)
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($server,$type,$database,$username,$password='',$persistent=false, $new=false)
Function normalizeReplacePK
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function normalizeReplacePK($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
{
$current = $this->connection->detailedDefinition($this->name);
echo ($mode==BasicModel::NORMALIZE_MODE_CHECK)?"Need to set primary key":"Setting primary key";
$sql = 'ALTER TABLE ' . $this->connection->identifierEscape($this->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
Function columnToArray
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function columnToArray($col)
{
$info = array();
$type = strtoupper($col->type);
if (property_exists($col, 'max_length') && $col->max_length != -1 && substr($type, -3) != 'INT') {
- 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"