andersondanilo/modelform

View on GitHub

Showing 12 of 12 total issues

Function setData has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function setData($data)
    {
        $oldForms = $this->items;
        $this->items = array();
        $dataByPos = array();
Severity: Minor
Found in src/FormSet.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

Form has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Form extends Collection
{
    public $_data = array();
    public $_model;
    public $_prefix;
Severity: Minor
Found in src/Form.php - About 2 hrs to fix

    Function __call has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __call($method, $arguments)
        {
            if(!$arguments)
                $arguments = array();
    
    
    Severity: Minor
    Found in src/Fields/Field.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

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

        public function decodeHtmlData($data) 
        {
            $dataAux = array();
            foreach ($data as $key => $value)
            {
    Severity: Minor
    Found in src/Form.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 setData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setData($data)
        {
            $oldForms = $this->items;
            $this->items = array();
            $dataByPos = array();
    Severity: Minor
    Found in src/FormSet.php - About 1 hr to fix

      Function __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($params=array())
          {
              if(isset($params['prefix']))
                  $this->setPrefix($params['prefix']);
              else
      Severity: Minor
      Found in src/Form.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 __call has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __call($method, $arguments)
          {
              if(!$arguments)
                  $arguments = array();
      
      
      Severity: Minor
      Found in src/Fields/Field.php - About 1 hr to fix

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

            public function __construct($params=array())
            {
                if(isset($params['prefix']))
                    $this->setPrefix($params['prefix']);
                else
        Severity: Minor
        Found in src/Form.php - About 1 hr to fix

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

              public function __construct(array $params=array())
              {
                  foreach($params as $k => $v) {
                      $k2 = "_$k";
                      if(property_exists($this, $k))
          Severity: Minor
          Found in src/Fields/Field.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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function save()
              {
                  $oldModels = $this->getDefaultModels();
                  $models = array();
                  foreach($this as $form) {
          Severity: Minor
          Found in src/FormSet.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 makeForms has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function makeForms() {
                  if(count($this) > 0)
                      trigger_error("forms already exists", E_USER_ERROR);
                  else
                  {
          Severity: Minor
          Found in src/FormSet.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

          Avoid too many return statements within this method.
          Open

                          return $this->getHtmlName();
          Severity: Major
          Found in src/Fields/Field.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language