chippyash/Strong-Type

View on GitHub

Showing 7 of 22 total issues

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

    protected function setFromTypes(array $params)
    {
        if (count($params) != count($this->valueMap)) {
            $numParams = count($params);
            $expectedParams = count($this->valueMap);
Severity: Minor
Found in src/Chippyash/Type/AbstractMultiValueType.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

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

    public function primeFactors()
    {
        // max_n = 2^31-1 = 2147483647
        $number = $this->value;
        $divisor = 2;
Severity: Minor
Found in src/Chippyash/Type/Number/IntType.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 convertType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function convertType($original)
    {
        if ($original instanceof AbstractRationalType) {
            return RationalTypeFactory::create(
                $original->numerator()->get(),
Severity: Minor
Found in src/Chippyash/Type/Number/Complex/ComplexTypeFactory.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 primeFactors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function primeFactors()
    {
        $number = $this->cloneValue();
        $divisor = 2;
        $zero = gmp_init(0);
Severity: Minor
Found in src/Chippyash/Type/Number/GMPIntType.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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function create($numerator, $denominator = null)
    {
        if (is_string($numerator)) {
            return self::fromString($numerator);
        }
Severity: Minor
Found in src/Chippyash/Type/Number/Rational/RationalTypeFactory.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 fromFloat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fromFloat($float, $tolerance = null)
    {
        if ($float instanceof FloatType) {
            $float = $float();
        }
Severity: Minor
Found in src/Chippyash/Type/Number/Rational/RationalTypeFactory.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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function stop($throw = false)
    {
        $errorException = null;

        if (static::$stack) {
Severity: Minor
Found in src/Chippyash/Zend/ErrorHandler.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