Showing 105 of 127 total issues
Function setSettings
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
private function setSettings(SettingManager $settingsmanager): void
{
$path = realpath(__DIR__.'/../../resources/presets/settings.json');
if ($path !== false) {
$content = file_get_contents($path);
- 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 install
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
install(app: Voyager) {
app.config.globalProperties.__ = function (key: string, replace = {}) {
return this.trans(key, replace);
};
app.config.globalProperties.trans = function (key: string, replace = {}) {
- 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 BreadController.php
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Voyager\Admin\Http\Controllers;
use DB;
File MediaController.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Voyager\Admin\Http\Controllers;
use Illuminate\Http\Request;
File Breads.php
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Voyager\Admin\Manager;
use Illuminate\Container\Container;
Function install
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
install(app: Voyager) {
app.config.globalProperties.toggleDirection = function () {
Store.rtl = !Store.rtl;
if (Store.rtl) {
document.querySelector('html')?.setAttribute('dir', 'rtl');
- 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 listFiles
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listFiles(Request $request)
{
$hide_thumbnails = VoyagerFacade::setting('media.hide-thumbnails', true);
$thumbnail_names = $this->getThumbnailDefinitions()->pluck('name')->transform(function ($name) {
return '_'.$name;
File VoyagerServiceProvider.php
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Voyager\Admin;
use Illuminate\Contracts\Auth\Access\Gate;
Function handle
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function handle(PluginManager $pluginmanager)
{
$name = $this->argument('plugin');
if (!is_string($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 prepareVoyager
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepareVoyager(data: VoyagerData) {
for (let key of Object.keys(data)) {
// @ts-ignore
Store[key] = data[key];
}
Breads
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Breads
{
protected Collection $formfields;
protected string $path;
protected ?Collection $breads = null;
Method relationship
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function relationship(Request $request): array
{
// TODO: Validate that the method exists in edit/add layout
$bread = $this->getBread($request, true);
list($perPage, $query, $method, $column) = array_values($request->only(['perPage', 'query', 'method', 'column', 'key']));
Function install
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
install(app: Voyager) {
app.config.globalProperties.toggleDirection = function () {
Store.rtl = !Store.rtl;
if (Store.rtl) {
document.querySelector('html')?.setAttribute('dir', 'rtl');
Method processUploadedFile
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processUploadedFile($file, $path)
{
$name = '';
$count = 0;
$thumbnails = 0;
Function install
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
install(app: Voyager) {
app.config.globalProperties.__ = function (key: string, replace = {}) {
return this.trans(key, replace);
};
app.config.globalProperties.trans = function (key: string, replace = {}) {
Function relationship
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function relationship(Request $request): array
{
// TODO: Validate that the method exists in edit/add layout
$bread = $this->getBread($request, true);
list($perPage, $query, $method, $column) = array_values($request->only(['perPage', 'query', 'method', 'column', 'key']));
- 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 mounted
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
mounted(el: TooltipElement, binding: any) {
let placement = 'bottom';
if (placements.includes(binding.arg)) {
placement = binding.arg;
} else if (binding.arg) {
Method launchPlugins
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function launchPlugins(?bool $protected = null): void
{
$this->getAllPlugins()->each(function (GenericPlugin $plugin) use ($protected) {
$start = round(microtime(true) * 1000);
$plugin->stats = [
Method handle
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(PluginManager $pluginmanager)
{
$name = $this->argument('plugin');
if (!is_string($name)) {
Method getModelRelationships
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModelRelationships(\ReflectionClass $reflection, Model $model, bool $resolve = false): Collection
{
$single = [
BelongsTo::class,
HasOne::class,