Dhii/container-helper-base

View on GitHub

Showing 6 of 32 total issues

Function _containerGet has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _containerGet($container, $key)
    {
        $origKey = $key;
        $key     = $this->_normalizeKey($key);
        // NotFoundExceptionInterface#getDataKey() returns `string` or `Stringable`,
Severity: Minor
Found in src/ContainerGetCapableTrait.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

Method _containerGet has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _containerGet($container, $key)
    {
        $origKey = $key;
        $key     = $this->_normalizeKey($key);
        // NotFoundExceptionInterface#getDataKey() returns `string` or `Stringable`,
Severity: Minor
Found in src/ContainerGetCapableTrait.php - About 1 hr to fix

    Function _containerUnset has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _containerUnset(&$container, $key)
        {
            $origKey = $key;
            $key     = $this->_normalizeKey($key);
    
    
    Severity: Minor
    Found in src/ContainerUnsetCapableTrait.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 _containerUnset has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _containerUnset(&$container, $key)
        {
            $origKey = $key;
            $key     = $this->_normalizeKey($key);
    
    
    Severity: Minor
    Found in src/ContainerUnsetCapableTrait.php - About 1 hr to fix

      Method _createNotFoundException has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $message = null,
              $code = null,
              RootException $previous = null,
              BaseContainerInterface $container = null,
              $dataKey = null
      Severity: Minor
      Found in src/ContainerListGetCapableTrait.php - About 35 mins to fix

        Function _containerHas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _containerHas($container, $key)
            {
                $key = $this->_normalizeKey($key);
        
                if ($container instanceof BaseContainerInterface) {
        Severity: Minor
        Found in src/ContainerHasCapableTrait.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