voyager-admin/voyager

View on GitHub
src/Manager/Breads.php

Summary

Maintainability
C
1 day
Test Coverage
C
71%

File Breads.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Voyager\Admin\Manager;

use Illuminate\Container\Container;
Severity: Minor
Found in src/Manager/Breads.php - About 4 hrs to fix

    Breads has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Breads
    {
        protected Collection $formfields;
        protected string $path;
        protected ?Collection $breads = null;
    Severity: Minor
    Found in src/Manager/Breads.php - About 3 hrs to fix

      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,
      Severity: Major
      Found in src/Manager/Breads.php - About 2 hrs to fix

        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';
        Severity: Minor
        Found in src/Manager/Breads.php - About 1 hr to fix

          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) {
          Severity: Minor
          Found in src/Manager/Breads.php - About 1 hr to fix

            Avoid too many return statements within this method.
            Wontfix

                    return $this->breads;
            Severity: Major
            Found in src/Manager/Breads.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return [$value->name_singular => $value];
              Severity: Major
              Found in src/Manager/Breads.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status