Showing 105 of 127 total issues
Method registerBulkActions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerBulkActions()
{
$breadmanager = $this->breadmanager;
$add_action = (new Action('voyager::generic.add_type', 'plus', null, 'green'))
Function show
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
show() {
if (this._confirm && this._buttons.length == 0) {
this.addButton({
key: true,
value: 'voyager::generic.yes',
Function delete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function delete(Request $request)
{
$storage = Storage::disk($this->disk);
$files_deleted = 0;
$dirs_deleted = 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 __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(?object $json = null)
{
if ($json) {
foreach ((array)$json as $key => $value) {
if ($key == '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 getProperties
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProperties(Request $request)
{
$table = $request->get('table', null);
if ($this->breadmanager->getBread($table)) {
Method register
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register()
{
app()->register(\Inertia\ServiceProvider::class);
$loader = AliasLoader::getInstance();
Method stored
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stored(mixed $model, mixed $value): void
{
$relationship = $this->getRelationship();
$method = $model->{$relationship['method']}();
Method getFormfields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFormfields()
{
return $this->formfields->map(function ($formfield) {
$component = 'Formfield'.Str::studly($formfield->type());
$builder_component = 'Formfield'.Str::studly($formfield->type()).'Builder';
Function resolve
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
resolve: name => {
// This is necessary so webpack doesn't load ALL components (by using require(`@components/${name}`))
let component = require(`@components/Generic.vue`).default;
if (name == 'Dashboard') {
Method read
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function read(Request $request, mixed $id): InertiaResponse
{
$bread = $this->getBread($request, true);
$layout = $this->breadmanager->getLayoutForAction($bread, 'read');
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
Function stored
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function stored(mixed $model, mixed $value): void
{
$relationship = $this->getRelationship();
$method = $model->{$relationship['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 getBreads
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBreads()
{
if (!$this->breads) {
VoyagerFacade::ensureDirectoryExists($this->path);
$this->breads = collect(File::files($this->path))->transform(function ($bread) {
Method getThumbnailOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getThumbnailOptions(Request $request): DynamicInput
{
$method = $request->input('method', 'fit');
$select = (new DynamicInput())
Method store
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request): \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
{
// Push a fake column object to settings
$settings = collect($request->get('settings', []))->transform(function ($setting) {
$setting = (object) $setting;
Method globalSearch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function globalSearch(Request $request): ?array
{
$q = $request->get('query');
$results = [];
$this->breadmanager->getBreads()->each(function ($bread) use ($q, &$results) {
Function mounted
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
mounted(el: TooltipElement, binding: any) {
let placement = 'bottom';
if (placements.includes(binding.arg)) {
placement = binding.arg;
} else if (binding.arg) {
- 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 download
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function download(Request $request)
{
$files = $request->get('files', []);
if (count($files) == 1 && $files[0]['file']['type'] !== 'directory') {
return Storage::disk($this->disk)->get($files[0]['file']['relative_path'].$files[0]['file']['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 addMultipleChoiceInput
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function addMultipleChoiceInput(string $type, ?string $key = null, string|array|null $title = null, ?array $options = [], ?bool $multiple = false, mixed $value = null): void
Method addNumber
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addNumber(?string $key = null, string|array|null $title = null, string|array|null $placeholder = null, ?int $value = null, ?int $min = null, ?int $max = null): self