chippyash/Math-Type-Calculator

View on GitHub

Showing 30 of 38 total issues

Avoid too many return statements within this method.
Open

                return $this->complexCompare($a->asComplex(), $b);
Severity: Major
Found in src/Chippyash/Math/Type/Comparator/Native.php - About 30 mins to fix

    Missing class import via use statement (line '63', column '23').
    Open

                throw new \InvalidArgumentException('No known comparator engine');

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid too many return statements within this method.
    Open

                    return $this->calcEngine->complexAdd($a->asComplex(), $b);
    Severity: Major
    Found in src/Chippyash/Math/Type/Calculator.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->calcEngine->complexSub($a, $b);
      Severity: Major
      Found in src/Chippyash/Math/Type/Calculator.php - About 30 mins to fix

        Missing class import via use statement (line '582', column '23').
        Open

                    throw new \BadMethodCallException('Cannot compute reciprocal of zero complex number');

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid too many return statements within this method.
        Open

                        return $this->calcEngine->complexDiv($a->asComplex(), $b);
        Severity: Major
        Found in src/Chippyash/Math/Type/Calculator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 'whole';
          Severity: Major
          Found in src/Chippyash/Math/Type/Traits/ArbitrateTwoTypes.php - About 30 mins to fix

            Missing class import via use statement (line '69', column '23').
            Open

                        throw new \InvalidArgumentException('No known calculator engine');

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

            Avoid too many return statements within this method.
            Open

                            return $this->calcEngine->complexAdd($a, $b);
            Severity: Major
            Found in src/Chippyash/Math/Type/Calculator.php - About 30 mins to fix

              The method arbitrate() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
              Open

                  protected function arbitrate(NumericTypeInterface $a, NumericTypeInterface $b)
                  {
                      $pairing = $this->getTypePairing($a, $b);
                      if ($pairing == 'complex:complex') {
                          return 'complex';

              NPathComplexity

              Since: 0.1

              The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

              Example

              class Foo {
                  function bar() {
                      // lots of complicated code
                  }
              }

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

              Severity
              Category
              Status
              Source
              Language