luyadev/luya-module-admin

View on GitHub
src/ngrest/render/RenderCrud.php

Summary

Maintainability
D
2 days
Test Coverage
A
90%

File RenderCrud.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace luya\admin\ngrest\render;

use luya\admin\components\Auth;
Severity: Minor
Found in src/ngrest/render/RenderCrud.php - About 6 hrs to fix

    RenderCrud has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RenderCrud extends Render implements ViewContextInterface, RenderCrudInterface
    {
        public const TYPE_LIST = 'list';
    
        public const TYPE_CREATE = 'create';
    Severity: Minor
    Found in src/ngrest/render/RenderCrud.php - About 5 hrs to fix

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

          public function getButtons()
          {
              // if already assigned return the resutl
              if ($this->_buttons) {
                  return $this->_buttons;
      Severity: Major
      Found in src/ngrest/render/RenderCrud.php - About 2 hrs to fix

        Function getButtons has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getButtons()
            {
                // if already assigned return the resutl
                if ($this->_buttons) {
                    return $this->_buttons;
        Severity: Minor
        Found in src/ngrest/render/RenderCrud.php - About 2 hrs 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 renderElementPlugins has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function renderElementPlugins($configContext, $typeConfig, $uniqueId, $attribute, $ngRestModel, $label, $elmni18n)
        Severity: Major
        Found in src/ngrest/render/RenderCrud.php - About 50 mins to fix

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

              public function getConfigButtonCondition($scope)
              {
                  $buttonConditionConfigOption = $this->config->getOption('buttonCondition');
          
                  // return empty string of no condition is defined
          Severity: Minor
          Found in src/ngrest/render/RenderCrud.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 evalGroupFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function evalGroupFields($pointerElements)
              {
                  $groups = [];
                  if (!$pointerElements) {
                      return [];
          Severity: Minor
          Found in src/ngrest/render/RenderCrud.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 renderElementPlugins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function renderElementPlugins($configContext, $typeConfig, $uniqueId, $attribute, $ngRestModel, $label, $elmni18n)
              {
                  $args = $typeConfig['args'];
                  $args['renderContext'] = $this;
                  $obj = NgRest::createPluginObject($typeConfig['class'], $attribute, $label, $elmni18n, $args);
          Severity: Minor
          Found in src/ngrest/render/RenderCrud.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 getFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getFields($type)
              {
                  if (!array_key_exists($type, $this->_fields)) {
                      $fields = [];
                      if ($this->config->hasPointer($type)) {
          Severity: Minor
          Found in src/ngrest/render/RenderCrud.php - About 25 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 apiQueryString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function apiQueryString($type)
              {
                  // basic query
                  $query = ['ngrestCallType' => $type];
          
          
          Severity: Minor
          Found in src/ngrest/render/RenderCrud.php - About 25 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