Showing 20 of 70 total issues
File Search.php
has 537 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\SearchComponents;
use HnhDigital\LaravelHtmlBuilder\Tag;
Search
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class Search
{
/**
* Config.
*
Function parseRequest
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function parseRequest()
{
$result = [
'count' => 0,
'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
Method parseRequest
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseRequest()
{
$result = [
'count' => 0,
'attributes' => [],
Function autoInit
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
autoInit: function() {
$('.hnhdigital-search-form').on('submit', function() {
var form = $(this);
var results = $('.'+$(this).attr('id').replace(new RegExp('-form$'), '-results'));
var page = $(form).find('[name=page]').val();
Method render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($html, $response = [])
{
$this->result = $html;
$this->result_response = $response;
Function updateResults
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateResults: function(results, response) {
if (!results.hasClass('hnhdigital-search-results')) {
var form_id = results.attr('id').replace(new RegExp('-form$'), '-results');
results = $('.'+form_id);
}
Function serialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
serialize: function(form, results) {
var search = {};
results.find('.search-field').each(function() {
Method getSearchInput
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSearchInput()
{
$total_columns = $this->checkColumns();
$search_input = Arr::get($this->config, 'search_input', []);
$force_search_input = Arr::get($this->config, 'force_search_input', false);
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function render($html, $response = [])
{
$this->result = $html;
$this->result_response = $response;
- 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 updateResults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
updateResults: function(results, response) {
if (!results.hasClass('hnhdigital-search-results')) {
var form_id = results.attr('id').replace(new RegExp('-form$'), '-results');
results = $('.'+form_id);
}
- 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 __call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __call($method, $arguments)
{
preg_match('/^(get|set)(.*)$/', $method, $matches);
if (count($matches)) {
- 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 autoInit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
autoInit: function() {
$('.hnhdigital-search-form').on('submit', function() {
var form = $(this);
var results = $('.'+$(this).attr('id').replace(new RegExp('-form$'), '-results'));
var page = $(form).find('[name=page]').val();
- 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 setRequest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function setRequest($name)
{
// Get the data from the request or provided array.
$request = is_array($name) ? $name : request($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 addRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addRequest(...$names)
{
$request = $this->config['request'];
// If names provided as an 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
Function generateSessionName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function generateSessionName($name, $class = '', $route_text = '', $route_parameters = [])
{
// Use the unique route as the session name.
if (! empty($route_text)) {
$name = str_replace(['[', ']', '::', ' '], ['', '-', '-', ''], $route_text);
- 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 $this;
Avoid too many return
statements within this method. Open
return $this;
Function getSearchInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getSearchInfo()
{
$total_columns = $this->checkColumns();
$search_info = Arr::get($this->config, 'search_info', []);
$tbody = Tag::tbody();
- 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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function run($query)
{
$this->query = clone $query;
// Run query.
- 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"