chippyash/Math-Matrix

View on GitHub

Showing 52 of 183 total issues

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

    protected function toFloat(array $dA)
    {
        foreach ($dA as &$row) {
            foreach ($row as &$entry) {
                if ($entry instanceof NumericTypeInterface) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/Formatter/AsciiNumeric.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 toInt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function toInt(array $dA)
    {
        foreach ($dA as &$row) {
            foreach ($row as &$entry) {
                if ($entry instanceof NumericTypeInterface) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/Formatter/AsciiNumeric.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 deeply nested control flow statements.
Open

                        if ($comp->eq($ipiv[$k], $zero())) {
                            $absVal = $dA[$j][$k]->abs();
                            if ($comp->gt($absVal, $big)) {
                                unset($big);
                                $big = clone $absVal;
Severity: Major
Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 45 mins to fix

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

        public function __construct($source, $normalizeDefault = 0)
        {
            if ($source instanceof self) {
                $this->store($source->toArray());
                return;
    Severity: Minor
    Found in src/Chippyash/Math/Matrix/NumericMatrix.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

    Method addMultipleOfOtherRowToRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function addMultipleOfOtherRowToRow(array &$a, $multiple, $rowToMultiplyWith,
                $rowToAddTo, Calculator $calc)
    Severity: Minor
    Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 35 mins to fix

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

          public function __construct(IntType $size, IntType $identityType = null)
          {
              if (is_null($identityType)) {
                  $idt = self::IDM_TYPE_INT;
              } else {
      Severity: Minor
      Found in src/Chippyash/Math/Matrix/IdentityMatrix.php - About 35 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 convertNumberToNumeric has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function convertNumberToNumeric($value)
          {
              switch(gettype($value)) {
                  case 'integer':
                      return TypeFactory::createInt($value);
      Severity: Minor
      Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToNumeric.php - About 35 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 invert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function invert(NumericMatrix $mA)
          {
              $rows = $mA->rows();
              $cols = $mA->columns();
              $work = array();
      Severity: Minor
      Found in src/Chippyash/Math/Matrix/Transformation/Strategy/Invert/Determinant.php - About 35 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 TypeFactory::createInt(($scalar ? 1 : 0));
      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 $this->transform(new $tName(), $extra);
        Severity: Major
        Found in src/Chippyash/Math/Matrix/NumericMatrix.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $mA;
          Severity: Major
          Found in src/Chippyash/Math/Matrix/Formatter/AsciiNumeric.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return RationalTypeFactory::create($scalar)->asComplex();
            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 RationalTypeFactory::create($value ? 1 : 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 ComplexTypeFactory::create(($scalar ? 1 : 0), 0);
                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::create(($value ? 1 : 0), 0);
                  Severity: Major
                  Found in src/Chippyash/Math/Matrix/Traits/ConvertNumberToComplex.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return TypeFactory::createRational($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 TypeFactory::createRational($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::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 TypeFactory::createInt(($value ? 1 : 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 ComplexTypeFactory::create($scalar);
                            Severity: Major
                            Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language