symphonycms/symphony-2

View on GitHub
symphony/lib/toolkit/class.widget.php

Summary

Maintainability
D
2 days
Test Coverage

File class.widget.php has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package toolkit
 */
/**
Severity: Minor
Found in symphony/lib/toolkit/class.widget.php - About 5 hrs to fix

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

        public static function Select($name, array $options = null, array $attributes = null)
        {
            General::ensureType(array(
                'name' => array('var' => $name, 'type' => 'string')
            ));
    Severity: Minor
    Found in symphony/lib/toolkit/class.widget.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

    Function TableHead has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function TableHead(array $columns = null)
        {
            $thead = new XMLElement('thead');
            $tr = new XMLElement('tr');
    
    
    Severity: Minor
    Found in symphony/lib/toolkit/class.widget.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 Select has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function Select($name, array $options = null, array $attributes = null)
        {
            General::ensureType(array(
                'name' => array('var' => $name, 'type' => 'string')
            ));
    Severity: Minor
    Found in symphony/lib/toolkit/class.widget.php - About 1 hr to fix

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

          public static function Checkbox($name, $value, $description = null, XMLElement &$wrapper = null, $help = null)
          {
              General::ensureType(array(
                  'name' => array('var' => $name, 'type' => 'string'),
                  'value' => array('var' => $value, 'type' => 'string', 'optional' => true),
      Severity: Minor
      Found in symphony/lib/toolkit/class.widget.php - About 1 hr to fix

        Method Drawer has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function Drawer($id = '', $label = '', XMLElement $content = null, $default_state = 'closed', $context = '', array $attributes = array())
        Severity: Minor
        Found in symphony/lib/toolkit/class.widget.php - About 45 mins to fix

          Method Table has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function Table(XMLElement $header = null, XMLElement $footer = null, XMLElement $body = null, $class = null, $id = null, Array $attributes = null)
          Severity: Minor
          Found in symphony/lib/toolkit/class.widget.php - About 45 mins to fix

            Method Anchor has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function Anchor($value, $href, $title = null, $class = null, $id = null, array $attributes = null)
            Severity: Minor
            Found in symphony/lib/toolkit/class.widget.php - About 45 mins to fix

              Method TableRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function TableRow(array $cells, $class = null, $id = null, $rowspan = null, Array $attributes = null)
              Severity: Minor
              Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

                Method Form has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static function Form($action = null, $method = 'post', $class = null, $id = null, array $attributes = null)
                Severity: Minor
                Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

                  Method Textarea has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function Textarea($name, $rows = 15, $cols = 50, $value = null, array $attributes = null)
                  Severity: Minor
                  Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

                    Method Label has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static function Label($name = null, XMLElement $child = null, $class = null, $id = null, array $attributes = null)
                    Severity: Minor
                    Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

                      Method TableData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static function TableData($value, $class = null, $id = null, $colspan = null, Array $attributes = null)
                      Severity: Minor
                      Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

                        Method Checkbox has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function Checkbox($name, $value, $description = null, XMLElement &$wrapper = null, $help = null)
                        Severity: Minor
                        Found in symphony/lib/toolkit/class.widget.php - About 35 mins to fix

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

                              public static function Table(XMLElement $header = null, XMLElement $footer = null, XMLElement $body = null, $class = null, $id = null, Array $attributes = null)
                              {
                                  General::ensureType(array(
                                      'class' => array('var' => $class, 'type' => 'string', 'optional' => true),
                                      'id' => array('var' => $id, 'type' => 'string', 'optional' => true)
                          Severity: Minor
                          Found in symphony/lib/toolkit/class.widget.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 TableData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function TableData($value, $class = null, $id = null, $colspan = null, Array $attributes = null)
                              {
                                  General::ensureType(array(
                                      'class' => array('var' => $class, 'type' => 'string', 'optional' => true),
                                      'id' => array('var' => $id, 'type' => 'string', 'optional' => true),
                          Severity: Minor
                          Found in symphony/lib/toolkit/class.widget.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 TableRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function TableRow(array $cells, $class = null, $id = null, $rowspan = null, Array $attributes = null)
                              {
                                  General::ensureType(array(
                                      'class' => array('var' => $class, 'type' => 'string', 'optional' => true),
                                      'id' => array('var' => $id, 'type' => 'string', 'optional' => true),
                          Severity: Minor
                          Found in symphony/lib/toolkit/class.widget.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 __SelectBuildOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function __SelectBuildOption($option)
                              {
                                  list($value, $selected, $desc, $class, $id, $attributes) = array_pad($option, 6, null);
                          
                                  if (!$desc) {
                          Severity: Minor
                          Found in symphony/lib/toolkit/class.widget.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