File dbMySQL.php
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace samson\activerecord;
use samsonframework\orm\QueryInterface;
use samsonframework\orm\ConditionInterface;
Function toRecords
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected function &toRecords($class_name, array & $response, array $join = array(), array $virtual_fields = array())
{
// Сформируем правильное имя класса
$class_name = strpos($class_name, '\\') !== false ? $class_name : '\\samson\activerecord\\'.$class_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 toRecords
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function &toRecords($class_name, array & $response, array $join = array(), array $virtual_fields = array())
{
// Сформируем правильное имя класса
$class_name = strpos($class_name, '\\') !== false ? $class_name : '\\samson\activerecord\\'.$class_name;
Function prepareSQL
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareSQL($class_name, QueryInterface $query)
{
//elapsed( 'dbMySQL::find() Начало');
$params = $this->__get_table_data($class_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 parseCondition
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function parseCondition($class_name, & $arg)
{
// Получим переменные для запроса
extract($this->__get_table_data($class_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 prepareSQL
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareSQL($class_name, QueryInterface $query)
{
//elapsed( 'dbMySQL::find() Начало');
$params = $this->__get_table_data($class_name);
// Получим переменные для запроса
Function migration
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function migration($classname, $version_handler)
{
if (!is_callable($version_handler)) {
return e('No version handler is passed', E_SAMSON_ACTIVERECORD_ERROR);
}
- 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 __get_table_data
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __get_table_data($class_name)
{
// Remove table prefix
$class_name = str_replace(self::$prefix, '', $class_name);
Method parseCondition
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseCondition($class_name, & $arg)
{
// Получим переменные для запроса
extract($this->__get_table_data($class_name));
Function createObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function &createObject(
$className,
$identifier,
array & $attributes,
array & $dbData,
- 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 createField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function createField($object, $table, $field, $type = 'INT')
{
// Check if db identifier field is configured
if (class_exists($table)) {
if (strlen($object->$field)) {
- 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 createObject
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$className,
$identifier,
array & $attributes,
array & $dbData,
array & $virtualFields = array()
Function getQueryFields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function &getQueryFields($className, & $object = null, $straight = false)
{
// Результирующая коллекция
$collection = array();
- 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 '1 = 0';
Avoid too many return
statements within this method. Open
return $sql_cond_t . ' NOT ' . $sql_values;
Function getConditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getConditions(ConditionInterface $cond_group, $class_name)
{
// Соберем сюда все сформированные условия для удобной "упаковки" их в строку
$sql_condition = array();
- 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"