chippyash/Math-Matrix

View on GitHub

Showing 52 of 183 total issues

Avoid too many return statements within this method.
Open

            return RationalTypeFactory::create($scalar);
Severity: Major
Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return $value;
    Severity: Major
    Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToNumeric.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return RationalTypeFactory::create(0, 1);
      Severity: Major
      Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToRational.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return TypeFactory::createInt(0);
        Severity: Major
        Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToNumeric.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return TypeFactory::createInt($scalar);
          Severity: Major
          Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return ComplexTypeFactory::fromString($value)->asRational();
            Severity: Major
            Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToRational.php - About 30 mins to fix

              Function doTransform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function doTransform(Matrix $mA, $extra = null)
                  {
                      $this->assertMatrixIsNumeric($mA);
              
                      if (!array_key_exists('start', $extra)) {
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Transformation/MarkovRandomWalk.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 doTransform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function doTransform(Matrix $mA, $extra = null)
                  {
                      $this->assertMatrixIsNumeric($mA);
              
                      if ($mA->is('empty')) {
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Transformation/Invert.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 is has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function is(Matrix $mA)
                  {
                      try {
                          $this->assertMatrixIsNumeric($mA)
                               ->assertMatrixIsSquare($mA);
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Attribute/IsMarkov.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 product has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function product($productName)
                  {
                      if (!array_key_exists($productName, $this->products)) {
                          throw new \InvalidArgumentException($productName);
                      }
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Decomposition/AbstractDecomposition.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 doComputation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function doComputation(NumericMatrix $mA, NumericMatrix $mB)
                  {
                      $size = max([$mA->columns(), $mA->rows(), $mB->columns(), $mB->rows()]);
                      $product = (new ZMatrix())->create([$size, $size])->toArray();
                      $dA = $mA->toArray();
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Computation/Mul/Matrix.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 getDeterminant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getDeterminant(NumericMatrix $mA)
                  {
                      switch ($this->method) {
                          case self::METHOD_AUTO;
                              if ($mA->rows() <= self::$luLimit) {
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Derivative/Determinant.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

              Severity
              Category
              Status
              Source
              Language