Method transformResults
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformResults(Layout $layout, bool $translatable, mixed $query, ?string $global, mixed $filters): mixed
{
return $query->transform(function ($item) use ($translatable, $layout) {
$item->primary_key = $item->getKey();
if ($translatable) {
Function applyCustomScope
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function applyCustomScope(Bread $bread, Layout $layout, mixed $filter, mixed $query, array &$warnings): mixed
{
if (!is_null($filter) && is_array($filter)) {
// Validate filter exists in layout
if (collect($layout->options->filters)->where('column', $filter['column'])->where('operator', $filter['operator'])->where('value', $filter['value'])->count() > 0) {
- 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 orderQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function orderQuery(Layout $layout, mixed $direction, mixed $order, mixed $query, string $locale, array &$warnings): mixed
{
if (!empty($direction) && !empty($order)) {
$formfield = $layout->getFormfieldByColumn($order);
if ($formfield && $formfield->column->type == 'column') {
- 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 orderQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function orderQuery(Layout $layout, mixed $direction, mixed $order, mixed $query, string $locale, array &$warnings): mixed
Method columnSearchQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function columnSearchQuery(array $filters, Layout $layout, mixed $query, string $locale, array &$warnings): mixed
Method applyCustomScope
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function applyCustomScope(Bread $bread, Layout $layout, mixed $filter, mixed $query, array &$warnings): mixed
Method queryColumn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function queryColumn(mixed $query, Formfield $formfield, mixed $filter, string $locale, bool $global = false): mixed
Method transformResults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function transformResults(Layout $layout, bool $translatable, mixed $query, ?string $global, mixed $filters): mixed
Function applyCustomFilter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function applyCustomFilter(Bread $bread, Layout $layout, mixed $filter, mixed $query): mixed
{
if (!is_null($filter) && is_array($filter)) {
// Validate filter exists in layout
if (collect($layout->options->filters)->where('column', $filter['column'])->where('operator', $filter['operator'])->where('value', $filter['value'])->count() > 0) {
- 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 queryColumn
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function queryColumn(mixed $query, Formfield $formfield, mixed $filter, string $locale, bool $global = false): mixed
{
$filter = '%'.strtolower($filter).'%';
$translatable = $formfield->translatable ?? false;
$column = $formfield->column->column;
- 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"