antaresproject/core

View on GitHub
src/ui/components/datatables/src/Html/Builder.php

Summary

Maintainability
D
2 days
Test Coverage

File Builder.php has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Part of the Antares package.
 *
Severity: Major
Found in src/ui/components/datatables/src/Html/Builder.php - About 1 day to fix

    Builder has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Builder extends BaseBuilder
    {
    
        /**
         * defered data
    Severity: Minor
    Found in src/ui/components/datatables/src/Html/Builder.php - About 4 hrs to fix

      Method generateScripts has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generateScripts()
          {
      
              app('antares.asset')->container('antares/foundation::application')
                      ->add('gridstack', '/webpack/view_datatables.js', ['webpack_gridstack', 'app_cache'])
      Severity: Major
      Found in src/ui/components/datatables/src/Html/Builder.php - About 3 hrs to fix

        Method beforeTable has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function beforeTable()
            {
                $hasMassActions  = $this->hasMassActions();
                $filters         = $this->filterAdapter->getFilters();
                $hasColumnFilter = $this->hasColumnFilter();
        Severity: Major
        Found in src/ui/components/datatables/src/Html/Builder.php - About 2 hrs to fix

          Function beforeTable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function beforeTable()
              {
                  $hasMassActions  = $this->hasMassActions();
                  $filters         = $this->filterAdapter->getFilters();
                  $hasColumnFilter = $this->hasColumnFilter();
          Severity: Minor
          Found in src/ui/components/datatables/src/Html/Builder.php - About 1 hr 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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct(Repository $config, Factory $view, HtmlBuilder $html, UrlGenerator $url, FormBuilder $form, FilterAdapter $filterAdapter, Router $router, Dispatcher $dispatcher)
          Severity: Major
          Found in src/ui/components/datatables/src/Html/Builder.php - About 1 hr to fix

            Function generateScripts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function generateScripts()
                {
            
                    app('antares.asset')->container('antares/foundation::application')
                            ->add('gridstack', '/webpack/view_datatables.js', ['webpack_gridstack', 'app_cache'])
            Severity: Minor
            Found in src/ui/components/datatables/src/Html/Builder.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

            Function addColumn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addColumn(array $attributes)
                {
                    $query  = $this->getQuery();
                    $orders = $query instanceof \Illuminate\Database\Eloquent\Builder ? $query->getQuery()->orders : null;
                    if (!isset($this->attributes['order']) and ! is_null($query) and ! is_null($orders)) {
            Severity: Minor
            Found in src/ui/components/datatables/src/Html/Builder.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

            There are no issues that match your filters.

            Category
            Status