Showing 64 of 70 total issues
Method getCurrentSearchQuery
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCurrentSearchQuery($options, $class_name, $model_filter = false)
{
$class_name = 'App\\Models\\'.$class_name;
extract($options);
$route_name = (!isset($route_name)) ? $current_model : $route_name;
Function scopeModelJoin
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function scopeModelJoin($query, $relationships, $operator = '=', $type = 'left', $where = false)
{
if (!is_array($relationships)) {
$relationships = [$relationships];
}
- 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 scopeModelJoin
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function scopeModelJoin($query, $relationships, $operator = '=', $type = 'left', $where = false)
{
if (!is_array($relationships)) {
$relationships = [$relationships];
}
Function returnSearchResult
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected static function returnSearchResult($controller_name, $distinct_session, $search_request, $response, $extra_response = false)
{
unset($search_request['rows']);
// Save filters to session
- 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 runStandardSubSearch
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runStandardSubSearch(&$view_data, $config, $model)
{
foreach ($config as $config_entry) {
list($page, $name, $variable, $method, $class, $view_settings, $search_settings) = array_pad($config_entry, 7, null);
Method getCurrentSearchDetails
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCurrentSearchDetails($use_session, $settings, $options, $search_name)
{
extract($options);
$options['route_paramater'] = (empty($options['route_paramater'])) ? $current_model : $options['route_paramater'];
Method showSearchAppliedFilters
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function showSearchAppliedFilters(&$tbody, &$search_request, $result, $model, $column_span = 1, $options = [])
{
self::pagination($result, $search_request);
// Applied filters
Method scopeApplyAttributeFilters
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function scopeApplyAttributeFilters($query, $search_request)
{
if (isset($search_request['filters']) && is_array($search_request['filters']) && !empty($search_request['filters'])) {
// Get available filters
Method checkSearchResults
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function checkSearchResults($table, $result, &$search_request, $name, $column_span = 1, $config = [])
{
self::pagination($result, $search_request);
$thead = false;
Method getAppliedFiltersArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAppliedFiltersArray($search_request)
{
$model = (new static());
$result = [];
foreach ($model->getFilterAttributes() as $filter_name => $filter_settings) {
Method returnSearchResult
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function returnSearchResult($controller_name, $distinct_session, $search_request, $response, $extra_response = false)
{
unset($search_request['rows']);
// Save filters to session
Function getCurrentSearchDetails
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getCurrentSearchDetails($use_session, $settings, $options, $search_name)
{
extract($options);
$options['route_paramater'] = (empty($options['route_paramater'])) ? $current_model : $options['route_paramater'];
- 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 getFilters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFilters: function(search_table_id)
{
var current_filters = {
'filters': {}
};
Method validateOperators
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function validateOperators($filter, &$method, &$arguments, $model, $filter_setting, $operator, $value1, $value2)
Function runStandardSubSearch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function runStandardSubSearch(&$view_data, $config, $model)
{
foreach ($config as $config_entry) {
list($page, $name, $variable, $method, $class, $view_settings, $search_settings) = array_pad($config_entry, 7, null);
- 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 checkSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected static function checkSearchResults($table, $result, &$search_request, $name, $column_span = 1, $config = [])
Method showSearchAppliedFilters
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected static function showSearchAppliedFilters(&$tbody, &$search_request, $result, $model, $column_span = 1, $options = [])
Avoid deeply nested control flow statements. Open
if (isset($settings['name'])) {
$filter_detail['name'] = $settings['name'].': '.$filter_detail['attribute_name'];
}
Avoid deeply nested control flow statements. Open
if (in_array($check_operator, $available_operators)) {
$operator = $check_operator;
$value1 = implode(' ', $value1_array);
}
Method scopeModelJoin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function scopeModelJoin($query, $relationships, $operator = '=', $type = 'left', $where = false)