Showing 49 of 49 total issues

Function checkValidity has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkValidity(ValidationItem $validationItem)
    {
        $values = $validationItem->getValue();


Severity: Minor
Found in src/UForm/Form/Element/Primary/Input/File.php - About 3 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 addOptions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function addOptions(array $options)
    {
        foreach ($options as $key => $option) {
            if (is_object($option)) {
                if (!$option instanceof Option) {
Severity: Minor
Found in src/UForm/Form/Element/Primary/Select/OptGroup.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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * @license see LICENSE
 */

Severity: Major
Found in src/UForm/Render/Html/Foundation5.php and 2 other locations - About 2 hrs to fix
src/UForm/Render/Html/Bootstrap2.php on lines 1..52
src/UForm/Render/Html/Bootstrap3.php on lines 1..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * @license see LICENSE
 */

Severity: Major
Found in src/UForm/Render/Html/Bootstrap2.php and 2 other locations - About 2 hrs to fix
src/UForm/Render/Html/Bootstrap3.php on lines 1..52
src/UForm/Render/Html/Foundation5.php on lines 1..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
/**
 * @license see LICENSE
 */

Severity: Major
Found in src/UForm/Render/Html/Bootstrap3.php and 2 other locations - About 2 hrs to fix
src/UForm/Render/Html/Bootstrap2.php on lines 1..52
src/UForm/Render/Html/Foundation5.php on lines 1..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function fromGlobalFilesVariable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fromGlobalFilesVariable(array $files = null, $checkIsUploaded = true)
    {
        if (null == $files) {
            $files = $_FILES;
        }
Severity: Minor
Found in src/UForm/FileUpload.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

Element has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Element
{
    use SemanticItem;
    use FilterGroup;
    use ValidatorGroup;
Severity: Minor
Found in src/UForm/Form/Element.php - About 2 hrs to fix

    Method checkValidity has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function checkValidity(ValidationItem $validationItem)
        {
            $values = $validationItem->getValue();
    
    
    
    Severity: Minor
    Found in src/UForm/Form/Element/Primary/Input/File.php - About 1 hr to fix

      Function validateItem has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function validateItem($item, ValidationItem $validationItem)
          {
              if (!$item instanceof FileUpload) {
                  $validationItem->setInvalid();
                  $message = new Message('Invalid file', [], self::NOT_A_FILE);
      Severity: Minor
      Found in src/UForm/Validator/File/MimeType.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 render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render($localData, array $options = [], \UForm\Form\FormContext $formContext = null)
          {
      
              $options = $this->processRenderOptionHandlers($localData, $options);
      
      
      Severity: Minor
      Found in src/UForm/Form/Element/Primary/Select.php - About 1 hr to fix

        Method addOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addOptions(array $options)
            {
                foreach ($options as $key => $option) {
                    if (is_object($option)) {
                        if (!$option instanceof Option) {
        Severity: Minor
        Found in src/UForm/Form/Element/Primary/Select/OptGroup.php - About 1 hr to fix

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

              private function __parseProperties(array $p = null)
              {
          
                  if (null === $p) {
                      $p = [];
          Severity: Minor
          Found in src/UForm/Tag.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render($localData, array $options = [], \UForm\Form\FormContext $formContext = null)
              {
          
                  $options = $this->processRenderOptionHandlers($localData, $options);
          
          
          Severity: Minor
          Found in src/UForm/Form/Element/Primary/TextArea.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 filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function filter($value)
              {
                  $newValue = filter_var($value, FILTER_VALIDATE_BOOLEAN, ['flags' => FILTER_NULL_ON_FAILURE]);
          
                  if (null === $newValue) {
          Severity: Minor
          Found in src/UForm/Filter/BooleanValue.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render($localData, array $options = [], \UForm\Form\FormContext $formContext = null)
              {
          
                  $options = $this->processRenderOptionHandlers($localData, $options);
          
          
          Severity: Minor
          Found in src/UForm/Form/Element/Primary/Select.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render($localData, array $options = [], \UForm\Form\FormContext $formContext = null)
              {
          
                  $options = $this->processRenderOptionHandlers($localData, $options);
          
          
          Severity: Minor
          Found in src/UForm/Form/Element/Primary/Input.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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function validate(ValidationItem $validationItem)
              {
          
                  $hasMatch = false;
          
          
          Severity: Minor
          Found in src/UForm/Validator/InRange.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 getFunctions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getFunctions()
              {
          
                  return [
          
          
          Severity: Minor
          Found in src/UForm/Render/TwigExtension.php - About 1 hr to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            <?php
            /**
             * @license see LICENSE
             */
            
            
            Severity: Major
            Found in src/UForm/Filter/RightTrim.php and 2 other locations - About 1 hr to fix
            src/UForm/Filter/LeftTrim.php on lines 1..63
            src/UForm/Filter/Trim.php on lines 1..63

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 104.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            <?php
            /**
             * @license see LICENSE
             */
            
            
            Severity: Major
            Found in src/UForm/Filter/LeftTrim.php and 2 other locations - About 1 hr to fix
            src/UForm/Filter/RightTrim.php on lines 1..63
            src/UForm/Filter/Trim.php on lines 1..63

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 104.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language