stk2k/collection

View on GitHub

Showing 5 of 7 total issues

Vector has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Vector extends Collection implements ArrayAccess
{
    use PhpArrayTrait;

    /**
Severity: Minor
Found in src/Vector.php - About 2 hrs to fix

    Function _indexOf has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _indexOf($target, int $start = NULL )
        {
            $values = $this->getValues();
            if ( $start === NULL ){
                $start = 0;
    Severity: Minor
    Found in src/Util/PhpArrayTrait.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 _last has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _last(callable $callback = null)
        {
            $values = $this->getValues();
            if ($callback){
                foreach(array_reverse($values) as $key => $value){
    Severity: Minor
    Found in src/Util/PhpArrayTrait.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 _first has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _first(callable $callback = null)
        {
            $values = $this->getValues();
            if ($callback){
                foreach($values as $key => $value){
    Severity: Minor
    Found in src/Util/PhpArrayTrait.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 _removeSameAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _removeSameAll(array $items) : array
        {
            $values = $this->getValues();
            foreach($values as $key => $value)
            {
    Severity: Minor
    Found in src/Util/PhpArrayTrait.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