GrafiteInc/FormMaker

View on GitHub
src/Forms/HtmlForm.php

Summary

Maintainability
D
1 day
Test Coverage

File HtmlForm.php has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Grafite\Forms\Forms;

use Exception;
Severity: Minor
Found in src/Forms/HtmlForm.php - About 3 hrs to fix

    HtmlForm has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HtmlForm extends Form
    {
        /**
         * Simple wrapper for cards
         *
    Severity: Minor
    Found in src/Forms/HtmlForm.php - About 3 hrs to fix

      Function formButtonsAndClose has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function formButtonsAndClose()
          {
              $rowAlignment = config('forms.form.sections.row-alignment-end', 'd-flex justify-content-end');
      
              if (isset($this->buttons['cancel']) || $this->columns === 'steps' || $this->buttonsJustified) {
      Severity: Minor
      Found in src/Forms/HtmlForm.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 __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct()
          {
              parent::__construct();
      
              $this->url = app(UrlGenerator::class);
      Severity: Minor
      Found in src/Forms/HtmlForm.php - About 1 hr to fix

        Method formButtonsAndClose has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function formButtonsAndClose()
            {
                $rowAlignment = config('forms.form.sections.row-alignment-end', 'd-flex justify-content-end');
        
                if (isset($this->buttons['cancel']) || $this->columns === 'steps' || $this->buttonsJustified) {
        Severity: Minor
        Found in src/Forms/HtmlForm.php - About 1 hr to fix

          Method formSubmitHtml has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function formSubmitHtml()
              {
                  $html = '';
                  $onSubmit = null;
          
          
          Severity: Minor
          Found in src/Forms/HtmlForm.php - About 1 hr to fix

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

                protected function parseFields($formFields)
                {
                    $fields = [];
            
                    if (empty($formFields)) {
            Severity: Minor
            Found in src/Forms/HtmlForm.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 formSubmitHtml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function formSubmitHtml()
                {
                    $html = '';
                    $onSubmit = null;
            
            
            Severity: Minor
            Found in src/Forms/HtmlForm.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