canax/htmlform

View on GitHub

Showing 29 of 37 total issues

Method __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(ContainerInterface $di)
    {
        parent::__construct($di);

        $license = "You must accept the <a href=http://opensource.org/licenses/GPL-3.0>license agreement</a>.";
Severity: Minor
Found in src/HTMLForm/FormModelCheckbox.php - About 1 hr to fix

    Method create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function create($form = [], $elements = [])
        {
            $defaults = [
                // Always have an id
                "id" => "anax/htmlform",
    Severity: Minor
    Found in src/HTMLForm/Form.php - About 1 hr to fix

      Method __construct has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(ContainerInterface $di)
          {
              parent::__construct($di);
              $this->form->create(
                  [
      Severity: Minor
      Found in src/HTMLForm/FormModelSelectOptionMultiple.php - About 1 hr to fix

        Method getHTML has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getHTML()
            {
                $details = $this->getHTMLDetails();
                extract($details);
        
        
        Severity: Minor
        Found in src/HTMLForm/FormElementCheckboxMultiple.php - About 1 hr to fix

          Function isValidCCNumber has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function isValidCCNumber( $ccNum ) {
              $digitsOnly = "";
              // Filter out non-digit characters
              for( $i = 0; $i < strlen( $ccNum ); $i++ ) {
                  if( is_numeric( substr( $ccNum, $i, 1 ) ) ) {
          Severity: Minor
          Found in htdocs/_test/test-creditcard-checkout.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 callbackSubmit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function callbackSubmit()
              {
                  // These return a single value
                  // Type checkbox returns true if checked
                  $elements = [
          Severity: Minor
          Found in src/HTMLForm/FormModelElementsAll.php - About 1 hr to fix

            Method __construct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct(ContainerInterface $di)
                {
                    parent::__construct($di);
                    $this->form->create(
                        [
            Severity: Minor
            Found in src/HTMLForm/FormModelValidateCustom.php - About 1 hr to fix

              Function getHTMLForElements has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getHTMLForElements($options = [])
                  {
                      $defaults = [
                          "use_buttonbar" => true,
                      ];
              Severity: Minor
              Found in src/HTMLForm/Form.php - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function validate($rules, $form = null)
                  {
                      $regExpEmailAddress = '/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i';
                      $tests = [
                          'fail' => [
              Severity: Minor
              Found in src/HTMLForm/FormElement.php - About 55 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

              Severity
              Category
              Status
              Source
              Language