Showing 19 of 33 total issues
Query
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Query
{
/**
* The array containing all of the query options that have been added.
*
Method testBuildSelectQuery
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBuildSelectQuery()
{
$distinct = true;
$expr = 'user_id, user_name, user_status';
$table = 'users';
Method testSelectQuery
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSelectQuery()
{
$query = Query::select();
$options = array(
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute($options)
{
// Save it for later!
$this->executed[] = $options;
Method testInsertAndSelect
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testInsertAndSelect()
{
// The row of data (user_id is what we expect it's value to be, since it is AUTO INCREMENT).
$row = array(
'user_id' => 1,
Method getInsertColumnNames
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getInsertColumnNames(array $rows)
{
$rowCount = count($rows);
// We can't have 0 rows...
Method getInsertColumnNames
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getInsertColumnNames(array $rows)
{
$rowCount = count($rows);
// We can't have 0 rows...
Method testExecute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testExecute()
{
$query = Query::select()
->expr('user_id')
->from('users')
Method testSetResult
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSetResult()
{
$resultSet = array(
array(
'user_id' => 1,
Method testUpdate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testUpdate()
{
// Insert some fake data.
$this->insertFakeData(3);
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($type)
{
$type = strtoupper($type);
// Make sure this is a type we know.
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($result, $affectedRows, $insertId, $errorCode, $errorMessage, $query = null)
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$result,
$affectedRows = 0,
$insertId = 0,
$errorCode = -1,
$errorMessage = null,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($result, $affectedRows, $insertId, $errorCode, $errorMessage, $query)
Function execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function execute($options)
{
// Save it for later!
$this->executed[] = $options;
- 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 addResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addResult($result, $affectedRows = 0, $insertId = 0, $errorCode = -1, $errorMessage = null)
Method setResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function setResult($result, $affectedRows = 0, $insertId = 0, $errorCode = -1, $errorMessage = null)
Function generateQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function generateQuery($options)
{
$query = null;
// Let's see what we got here.
- 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 generateQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function generateQuery($options)
{
$query = null;
// Let's see what we got here.
- 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"