chippyash/Matrix

View on GitHub

Showing 21 of 64 total issues

Function set has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($row, $col, $data)
    {
        if ($row < 0 || $row > $this->rows()) {
            throw new VerticeOutOfBoundsException('row', $row);
        }
Severity: Minor
Found in src/Chippyash/Matrix/Traits/Mutability.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 is has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function is(Matrix $mA)
    {
        if (!$mA->is('square')) {
            return false;
        }
Severity: Minor
Found in src/Chippyash/Matrix/Attribute/IsDiagonal.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkEntryEquality(Matrix $mB, $strict)
    {
        $dA = $this->toArray();
        $dB = $mB->toArray();
        $m = $this->rows();
Severity: Minor
Found in src/Chippyash/Matrix/Matrix.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 set has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set($row, $col, $data)
    {
        if ($row < 0 || $row > $this->rows()) {
            throw new VerticeOutOfBoundsException('row', $row);
        }
Severity: Minor
Found in src/Chippyash/Matrix/Traits/Mutability.php - About 1 hr to fix

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

        protected function doTransform(Matrix $mA, $extra = null)
        {
            /** @noinspection PhpInternalEntityUsedInspection */
            $this->assertParameterIsArray($extra, 'Second operand is not an array');
    
    
    Severity: Minor
    Found in src/Chippyash/Matrix/Transformation/Resize.php - About 1 hr to fix

      Method is has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function is(Matrix $mA)
          {
              //empty matrix is ok
              if ($mA->is('empty')) {
                  return true;
      Severity: Minor
      Found in src/Chippyash/Matrix/Attribute/IsComplete.php - About 1 hr to fix

        Method doTransform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function doTransform(Matrix $mA, $extra = null)
            {
                $this->assertMatrixIsComplete($mA);
        
                if ($mA->is('empty')) {
        Severity: Minor
        Found in src/Chippyash/Matrix/Transformation/Shift.php - About 1 hr to fix

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

              protected function doTransform(Matrix $mA, $extra = null)
              {
                  /** @noinspection PhpInternalEntityUsedInspection */
                  $this->assertParameterIsArray($extra, 'Second operand is not an array');
          
          
          Severity: Minor
          Found in src/Chippyash/Matrix/Transformation/Resize.php - About 55 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 __construct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct($source, $complete = false, $normalize= false, $normalizeDefault = null)
              {
                  if ($source instanceof Matrix) {
                      $this->store($source->toArray());
                      return;
          Severity: Minor
          Found in src/Chippyash/Matrix/Matrix.php - About 55 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

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

              public function get($row, $col)
              {
                  if ($row < 0 || $row > $this->rows()) {
                      throw new VerticeOutOfBoundsException('row', $row);
                  }
          Severity: Minor
          Found in src/Chippyash/Matrix/Matrix.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 too many return statements within this method.
          Open

                      return $this->reduceRows($mA, abs($numRows));
          Severity: Major
          Found in src/Chippyash/Matrix/Transformation/Resize.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return ($direction == 1 ? $ret : $fReflect($ret, Reflect::REFL_Y));
            Severity: Major
            Found in src/Chippyash/Matrix/Transformation/Shift.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return (
                          $numRows > 0
                              ? $this->addRows($interim, $numRows, $defValue)
                              : $this->reduceRows($interim, abs($numRows))
                      );
              Severity: Major
              Found in src/Chippyash/Matrix/Transformation/Resize.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)
                    {
                        if ($mA->is('empty')) {
                            return new Matrix(array());
                        }
                Severity: Minor
                Found in src/Chippyash/Matrix/Transformation/Rowslice.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)
                    {
                        if (is_null($extra)) {
                            throw new TransformationException('Reflection plane not specified');
                        } else {
                Severity: Minor
                Found in src/Chippyash/Matrix/Transformation/Reflect.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 test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function test($attribute)
                    {
                        if (is_string($attribute)) {
                            $attribute = ucfirst(strtolower($attribute));
                            $class = self::NS_ATTRIBUTE. $attribute;
                Severity: Minor
                Found in src/Chippyash/Matrix/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 doTransform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function doTransform(Matrix $mA, $extra = null)
                    {
                        if ($mA->is('empty')) {
                            return new Matrix([]);
                        }
                Severity: Minor
                Found in src/Chippyash/Matrix/Transformation/Colreduce.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)
                    {
                        if ($mA->is('empty')) {
                            return new Matrix([]);
                        }
                Severity: Minor
                Found in src/Chippyash/Matrix/Transformation/Cofactor.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)
                    {
                        if ($mA->is('empty')) {
                            return new Matrix(array());
                        }
                Severity: Minor
                Found in src/Chippyash/Matrix/Transformation/Colslice.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