Showing 194 of 194 total issues
Function processAttributeFilter
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
private static function processAttributeFilter($query, $filter_setting, $filter_requests)
{
$model = (new static());
foreach ($filter_requests as $filter_request) {
// Clean inputs
- 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 compose
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
public function compose(View $view)
{
// Get the data assigned to this view
$view_data = $view->getData();
$filter_types = [];
- 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 getFilterAttributes
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
public static function getFilterAttributes($first_call = true)
{
$model = (new static());
if (isset($model->filter_attributes) && is_array($model->filter_attributes)) {
- 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 ModelTrait.php
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\LaravelModelFilter\Traits;
use DB;
File ControllerTrait.php
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\LaravelModelFilter\Traits;
use HnhDigital\LaravelModelFilter\Objects\SearchViewOptions;
Function getAppliedFiltersArray
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function getAppliedFiltersArray($search_request)
{
$model = (new static());
$result = [];
foreach ($model->getFilterAttributes() as $filter_name => $filter_settings) {
- 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 getCurrentSearchQuery
has a Cognitive Complexity of 36 (exceeds 5 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;
- 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 validateOperators
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function validateOperators($filter, &$method, &$arguments, $model, $filter_setting, $operator, $value1, $value2)
{
// No space search.
if (array_has($filter_setting, 'phone_search')) {
$value1_numeric = str_replace(' ', '', $value1);
File search.js
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
$(document).ready(function() {
/* User clicks the availablle filters */
var track_filters = 0;
Function showSearchAppliedFilters
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
protected static function showSearchAppliedFilters(&$tbody, &$search_request, $result, $model, $column_span = 1)
{
self::pagination($result, $search_request);
// Applied filters
- 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 validateOperators
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static function validateOperators($filter, &$method, &$arguments, $model, $filter_setting, $operator, $value1, $value2)
{
// No space search.
if (array_has($filter_setting, 'phone_search')) {
$value1_numeric = str_replace(' ', '', $value1);
- 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 scopeApplyAttributeFilters
has a Cognitive Complexity of 26 (exceeds 5 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
- 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 compose
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compose(View $view)
{
// Get the data assigned to this view
$view_data = $view->getData();
$filter_types = [];
Method processAttributeFilter
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function processAttributeFilter($query, $filter_setting, $filter_requests)
{
$model = (new static());
foreach ($filter_requests as $filter_request) {
// Clean inputs
Function loadFilter
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function loadFilter(HttpRequest $request, ModelFilter $model_filter)
{
$model_name = 'App\\Models\\'.$request->get('model');
$method_name = $request->get('method');
- 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 loadFilter
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadFilter(HttpRequest $request, ModelFilter $model_filter)
{
$model_name = 'App\\Models\\'.$request->get('model');
$method_name = $request->get('method');
Function checkSearchResults
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected static function checkSearchResults($table, $result, &$search_request, $name, $column_span = 1, $config = [])
{
self::pagination($result, $search_request);
$thead = 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 update
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(search_table_id, response)
{
var search_table = $('#'+search_table_id);
if (typeof response.rows != 'undefined') {
Function update
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
update: function(search_table_id, response)
{
var search_table = $('#'+search_table_id);
if (typeof response.rows != 'undefined') {
- 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 getFilterAttributes
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFilterAttributes($first_call = true)
{
$model = (new static());
if (isset($model->filter_attributes) && is_array($model->filter_attributes)) {