Function generate
has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring. Open
public function generate($extra_param = false)
{
$output = '';
$page = $this->input->getParam('page');
- 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
File DataGrid.php
has 811 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* PepisCMS
*
Function generateFilters
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public function generateFilters($page = false, $order_by = false, $order = false, $applied_filter_values = -1)
{
$filters_output = '';
if ($applied_filter_values == -1) {
- 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
DataGrid
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class DataGrid extends ContainerAware
{
/**
* Basic search filter
*/
Method generate
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate($extra_param = false)
{
$output = '';
$page = $this->input->getParam('page');
Method generateFilters
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateFilters($page = false, $order_by = false, $order = false, $applied_filter_values = -1)
{
$filters_output = '';
if ($applied_filter_values == -1) {
Function generatePagination
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private function generatePagination($no_of_pages, $order_by, $order, $applied_filter_values, $page)
{
if ($no_of_pages < 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
Function encodeFiltersString
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function encodeFiltersString($filters)
{
if (!is_array($filters)) {
return false;
}
- 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 getFiltersForDataFeed
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getFiltersForDataFeed()
{
$pairs = $this->getFilterPairs();
$applied_filter_values = array(); // For links and user interface
- 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 generatePagination
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generatePagination($no_of_pages, $order_by, $order, $applied_filter_values, $page)
{
if ($no_of_pages < 1) {
return '';
}
Method addColumnByDefinition
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addColumnByDefinition($column, $key = false)
{
$defaults = $this->getFieldDefaults();
if (!isset($column['filter_condition']) && isset($column['filter_type'])) {
$defaults['filter_condition'] = $this->getDefaultFilterConditionByFilterType($column['filter_type']);
Method getFieldDefaults
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFieldDefaults()
{
$defaults = array();
$defaults['field'] = false; // Field name
$defaults['label'] = false; // Field label
Function addColumnByDefinition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addColumnByDefinition($column, $key = false)
{
$defaults = $this->getFieldDefaults();
if (!isset($column['filter_condition']) && isset($column['filter_type'])) {
$defaults['filter_condition'] = $this->getDefaultFilterConditionByFilterType($column['filter_type']);
- 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 generateLink
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function generateLink($base_url, $page = 1, $order_by = false, $order = false, $filters = false)
{
$url = $base_url;
if ($page > 1) {
$url .= '/page-' . $page;
- 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 addFilter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addFilter($label, $field = false, $filter_type = self::FILTER_BASIC, $filter_values = false, $filter_condition = false)
{
if (!is_array($label)) {
if (!$filter_condition) {
$filter_condition = $this->getDefaultFilterConditionByFilterType($filter_type);
- 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 generateLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function generateLink($base_url, $page = 1, $order_by = false, $order = false, $filters = false)
Method addFilter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addFilter($label, $field = false, $filter_type = self::FILTER_BASIC, $filter_values = false, $filter_condition = false)
Method generatePagination
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generatePagination($no_of_pages, $order_by, $order, $applied_filter_values, $page)