voyager-admin/voyager

View on GitHub

Showing 105 of 127 total issues

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) {
Severity: Minor
Found in src/Classes/Media.php - About 45 mins to fix

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
Severity: Minor
Found in src/Classes/DynamicInput.php - About 45 mins to fix

    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
    Severity: Minor
    Found in src/Traits/Bread/Browsable.php - About 45 mins to fix

      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();
              }
      Severity: Minor
      Found in src/Traits/Facade/Localization.php - About 45 mins to fix

      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
      Severity: Minor
      Found in src/Classes/DynamicInput.php - About 35 mins to fix

        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
        Severity: Minor
        Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

          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
          Severity: Minor
          Found in src/Classes/Action.php - About 35 mins to fix

            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
            Severity: Minor
            Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

              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
              Severity: Minor
              Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

                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
                Severity: Minor
                Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

                  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();
                  Severity: Minor
                  Found in src/VoyagerServiceProvider.php - About 35 mins to fix

                  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 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();
                          }
                  Severity: Minor
                  Found in src/Traits/Facade/Localization.php - About 35 mins to fix

                  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)) {
                  Severity: Minor
                  Found in src/Traits/Translatable.php - About 35 mins to fix

                  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'];
                              
                  Severity: Minor
                  Found in src/Http/Controllers/Controller.php - About 35 mins to fix

                  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)) {
                  Severity: Minor
                  Found in src/Http/Controllers/BreadBuilderController.php - About 35 mins to fix

                  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;
                          }
                  Severity: Minor
                  Found in src/Manager/Settings.php - About 35 mins to fix

                  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;
                  Severity: Minor
                  Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

                  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) {
                  Severity: Minor
                  Found in src/Traits/Bread/Browsable.php - About 35 mins to fix

                  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 $default;
                  Severity: Major
                  Found in src/Manager/Settings.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return;
                    Severity: Major
                    Found in src/Commands/PluginsCommand.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language