kahlan/kahlan

View on GitHub
src/Util/Text.php

Summary

Maintainability
A
3 hrs
Test Coverage
A
100%

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

    protected static function _dump($string)
    {
        $es = ['0', 'x07', 'x08', 't', 'n', 'v', 'f', 'r'];
        $unescaped = '';
        $chars = str_split($string);
Severity: Minor
Found in src/Util/Text.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 _objectToString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function _objectToString($value, $options)
    {
        if ($value instanceof Throwable) {
            $msg = '`' . get_class($value) .'` Code(' . $value->getCode() . ') with ';
            $message = $value->getMessage();
Severity: Minor
Found in src/Util/Text.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 clean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function clean($str, $options = [])
    {
        $options += [
            'before'      => '{:',
            'after'       => '}',
Severity: Minor
Found in src/Util/Text.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 _arrayToString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }
Severity: Minor
Found in src/Util/Text.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 $quote . addcslashes($value, $quote) . $quote;
Severity: Major
Found in src/Util/Text.php - About 30 mins to fix

    There are no issues that match your filters.

    Category
    Status