chippyash/Math-Matrix

View on GitHub

Showing 183 of 183 total issues

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

The class NumericMatrix has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Open

class NumericMatrix extends Matrix
{
    use ConvertNumberToNumeric;

    const NS_NUMERIC_ATTRIBUTE = 'Chippyash\Math\Matrix\Attribute\Is';

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

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

                throw new \InvalidArgumentException("{$name} is unknown for tuning");

    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 TypeFactory::createInt(($scalar ? 1 : 0));
    Severity: Major
    Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 30 mins to fix

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

                  throw new \InvalidArgumentException('$rows must be >= 1');

      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

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

                  throw new \InvalidArgumentException('$cols must be >= 1');

      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->transform(new $tName(), $extra);
      Severity: Major
      Found in src/Chippyash/Math/Matrix/NumericMatrix.php - About 30 mins to fix

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

                   throw new \InvalidArgumentException($attr());

        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 $mA;
        Severity: Major
        Found in src/Chippyash/Math/Matrix/Formatter/AsciiNumeric.php - About 30 mins to fix

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

                      throw new \InvalidArgumentException($productName);

          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

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

                      throw new \InvalidArgumentException('Matrix is not NumericMatrix');

          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

          Missing class import via use statement (line '53', column '27').
          Open

                          throw new \InvalidArgumentException('options[attribs]');

          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

          Missing class import via use statement (line '60', column '27').
          Open

                          throw new \InvalidArgumentException('pptions[edgeFunc]');

          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

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

                      throw new \InvalidArgumentException('$cols must be >= 1');

          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

          Missing class import via use statement (line '221', column '19').
          Open

                  throw new \InvalidArgumentException(self::ERR_INVALID_OP_NAME);

          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 RationalTypeFactory::create($scalar)->asComplex();
          Severity: Major
          Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language