chippyash/Math-Matrix

View on GitHub

Showing 52 of 183 total issues

Function decompose has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function decompose(NumericMatrix $mA, $extra = null)
    {
        $this->assertParameterIsMatrix($extra, 'Parameter extra is not a matrix')
                ->assertMatrixIsNumeric($extra, 'Parameter extra is not a numeric matrix')
                ->assertMatrixIsSquare($mA,
Severity: Minor
Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 4 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 createCorrectScalarType has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function createCorrectScalarType(NumericMatrix $originalMatrix , $scalar)
    {
        if ($scalar instanceof NumericTypeInterface) {
            if ($originalMatrix instanceof RationalMatrix) {
                return $scalar->asRational();
Severity: Minor
Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.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 LUDecomposition has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    protected function LUDecomposition(NumericMatrix $mA)
    {
        // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
        $LU = $mA->toArray();
        $m = $this->rows = $mA->rows();
Severity: Minor
Found in src/Chippyash/Math/Matrix/Decomposition/Lu.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 createRational has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createRational(array $data)
    {
        foreach ($data as &$row) {
            foreach ($row as &$item) {
                if (!$item instanceof RationalType) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/MatrixFactory.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

Function createComplex has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createComplex(array $data)
    {
        foreach ($data as &$row) {
            foreach ($row as &$item) {
                if (!$item instanceof ComplexType) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/MatrixFactory.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

Function checkEntryEquality has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkEntryEquality(Matrix $mB, $strict)
    {
        if ($strict) {
            if (get_class($this) !== get_class($mB)) {
                return false;
Severity: Minor
Found in src/Chippyash/Math/Matrix/NumericMatrix.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

Method decompose has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function decompose(NumericMatrix $mA, $extra = null)
    {
        $this->assertParameterIsMatrix($extra, 'Parameter extra is not a matrix')
                ->assertMatrixIsNumeric($extra, 'Parameter extra is not a numeric matrix')
                ->assertMatrixIsSquare($mA,
Severity: Major
Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 2 hrs to fix

    Method format has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function format(Matrix $mA, array $options = array())
        {
            if (!$mA instanceof NumericMatrix) {
                throw new \InvalidArgumentException('Matrix is not NumericMatrix');
            }
    Severity: Major
    Found in src/Chippyash/Math/Matrix/Formatter/DirectedGraph.php - About 2 hrs to fix

      Method LUDecomposition has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function LUDecomposition(NumericMatrix $mA)
          {
              // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
              $LU = $mA->toArray();
              $m = $this->rows = $mA->rows();
      Severity: Minor
      Found in src/Chippyash/Math/Matrix/Decomposition/Lu.php - About 2 hrs to fix

        Method createCorrectScalarType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function createCorrectScalarType(NumericMatrix $originalMatrix , $scalar)
            {
                if ($scalar instanceof NumericTypeInterface) {
                    if ($originalMatrix instanceof RationalMatrix) {
                        return $scalar->asRational();
        Severity: Minor
        Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 1 hr to fix

          Method __invoke has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __invoke()
              {
                  //argument arbitrage
                  $numArgs = func_num_args();
                  if ($numArgs == 1) {
          Severity: Minor
          Found in src/Chippyash/Math/Matrix/NumericMatrix.php - About 1 hr to fix

            Method convertNumberToNumeric has 31 lines of code (exceeds 25 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 1 hr to fix

              Method validateArguments has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function validateArguments(array $args)
                  {
                      $valA = new HasTypeMap([
                              'x' => 'integer'
                          ]
              Severity: Minor
              Found in src/Chippyash/Math/Matrix/Special/Chebspec.php - About 1 hr to fix

                Method validateArguments has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function validateArguments(array $args)
                    {
                        $valA = new HasTypeMap([
                                'x' => 'integer'
                            ]
                Severity: Minor
                Found in src/Chippyash/Math/Matrix/Special/Cauchy.php - About 1 hr to fix

                  Method setLowerProduct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function setLowerProduct(NumericMatrix $mA)
                      {
                          $m = $this->LU->rows();
                          $n = $this->LU->columns();
                          $LU = $this->LU->toArray();
                  Severity: Minor
                  Found in src/Chippyash/Math/Matrix/Decomposition/Lu.php - About 1 hr to fix

                    Function is has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function is(Matrix $mA)
                        {
                            if (!$mA instanceof NumericMatrix) {
                                return false;
                            }
                    Severity: Minor
                    Found in src/Chippyash/Math/Matrix/Attribute/IsIdentity.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 setUpperProduct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function setUpperProduct(NumericMatrix $mA)
                        {
                            $n = $this->LU->columns();
                            $LU = $this->LU->toArray();
                            $rcFactor = $this->cols -$this->rows;
                    Severity: Minor
                    Found in src/Chippyash/Math/Matrix/Decomposition/Lu.php - About 1 hr to fix

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

                          public function __invoke()
                          {
                              //argument arbitrage
                              $numArgs = func_num_args();
                              if ($numArgs == 1) {
                      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

                      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 toRational has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function toRational(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

                        Severity
                        Category
                        Status
                        Source
                        Language