Showing 105 of 127 total issues
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
Avoid deeply nested control flow statements. Open
if (!empty($setting->key) && !empty($setting->info)) {
if (empty($setting->group)) {
$this->line('New setting: "'.$setting->key.'": '.$setting->info);
} else {
$this->line('New setting: "'.$setting->group.'.'.$setting->key.'": '.$setting->info);
Function translate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function translate(mixed $value, ?string $locale = null, ?string $fallback = null): ?string
{
if ($locale == null) {
$locale = app()->getLocale();
}
- 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 __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(mixed $input)
{
foreach ($input as $key => $value) {
if ($key == 'meta') {
foreach ($value as $meta_key => $meta_value) {
- 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 addSelect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addSelect(?string $key = null, string|array|null $title = null, ?array $options = [], ?bool $multiple = false, mixed $value = null): self
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
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public string $title,
public ?string $icon = null,
public ?string $buttoncolor = null,
public ?string $iconcolor = null,
public ?string $textcolor = null
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
Function setTranslation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setTranslation(mixed $input, mixed $value, ?string $locale = null): mixed
{
if ($locale == null) {
$locale = app()->getLocale();
}
- 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 getBread
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function getBread(Request $request, bool $withRelationships = false): Bread
{
if ($request->route() instanceof \Illuminate\Routing\Route && $request->route()->getAction()['bread']) {
$bread = $request->route()->getAction()['bread'];
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function save(mixed $content = null): void
{
if (is_null($content)) {
$content = $this->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 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"
Further reading
Function __set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __set($key, $value): void
{
$this->setLocales();
if ($this->shouldColumnBeTranslated($key)) {
if (is_array($value) || is_object($value)) {
- 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 getProperties
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getProperties(Request $request)
{
$table = $request->get('table', null);
if ($this->breadmanager->getBread($table)) {
- 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 boot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function boot(Router $router): void
{
$router->aliasMiddleware('voyager.admin', VoyagerAdminMiddleware::class);
$this->registerResources();
- 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 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
Avoid too many return
statements within this method. Open
return [$value->name_singular => $value];
Avoid too many return
statements within this method. Open
return [
'key' => $item->getKey(),
'value' => $translatable ? VoyagerFacade::translate($item->{$column}) : $item->{$column},
];