razielsd/phpSelenide

View on GitHub
lib/Selenide/ElementsCollection.php

Summary

Maintainability
C
1 day
Test Coverage

ElementsCollection has 39 functions (exceeds 20 allowed). Consider refactoring.
Open

class ElementsCollection implements Iterator, Countable, ArrayAccess
{
    const MODE_SINGLE_ELEMENT = 1;
    const MODE_COLLECTION_ELEMENT = 2;

Severity: Minor
Found in lib/Selenide/ElementsCollection.php - About 5 hrs to fix

    File ElementsCollection.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Selenide;
    
    use ArrayAccess;
    Severity: Minor
    Found in lib/Selenide/ElementsCollection.php - About 3 hrs to fix

      The class ElementsCollection has 32 non-getter- and setter-methods. Consider refactoring ElementsCollection to keep number of methods under 25.
      Open

      class ElementsCollection implements Iterator, Countable, ArrayAccess
      {
          const MODE_SINGLE_ELEMENT = 1;
          const MODE_COLLECTION_ELEMENT = 2;
      
      
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class ElementsCollection has an overall complexity of 65 which is very high. The configured complexity threshold is 50.
      Open

      class ElementsCollection implements Iterator, Countable, ArrayAccess
      {
          const MODE_SINGLE_ELEMENT = 1;
          const MODE_COLLECTION_ELEMENT = 2;
      
      
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      The class ElementsCollection has 30 public methods. Consider refactoring ElementsCollection to keep number of public methods under 10.
      Open

      class ElementsCollection implements Iterator, Countable, ArrayAccess
      {
          const MODE_SINGLE_ELEMENT = 1;
          const MODE_COLLECTION_ELEMENT = 2;
      
      
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class ElementsCollection has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
      Open

      class ElementsCollection implements Iterator, Countable, ArrayAccess
      {
          const MODE_SINGLE_ELEMENT = 1;
          const MODE_COLLECTION_ELEMENT = 2;
      
      
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

      The method prepareResult has a boolean flag argument $asArray, which is a certain sign of a Single Responsibility Principle violation.
      Open

          protected function prepareResult(array $result, $asArray = false)
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Avoid unused parameters such as '$offset'.
      Open

          public function offsetSet($offset, $value)
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused parameters such as '$value'.
      Open

          public function offsetSet($offset, $value)
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused parameters such as '$offset'.
      Open

          public function offsetUnset($offset)
      Severity: Minor
      Found in lib/Selenide/ElementsCollection.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      There are no issues that match your filters.

      Category
      Status