Jagepard/Rudra-Container

View on GitHub

Showing 5 of 5 total issues

Function getParamsIoC has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    private function getParamsIoC(ReflectionMethod $constructor, ?array $params): array
    {
        $i = 0;
        $paramsIoC = [];
        $params = (is_array($params) && array_key_exists(0, $params)) ? $params : [$params];
Severity: Minor
Found in src/Rudra.php - About 3 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 getParamsIoC has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getParamsIoC(ReflectionMethod $constructor, ?array $params): array
    {
        $i = 0;
        $paramsIoC = [];
        $params = (is_array($params) && array_key_exists(0, $params)) ? $params : [$params];
Severity: Minor
Found in src/Rudra.php - About 1 hr to fix

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

        public function get(string $key = null): mixed
        {
            if (isset($key) && !$this->has($key)) {
                if (!$this->waiting()->has($key)) {
                    if (class_exists($key)) {
    Severity: Minor
    Found in src/Rudra.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 config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        function config(?string $key, ?string $subKey = null): mixed
        {
            if (isset($key)) {
                if (isset($subKey)) {
                    if (isset(Rudra::config()->get($key)[$subKey])) {
    Severity: Minor
    Found in src/helpers.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 set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function set(array $data): void
        {
            list($key, $object) = $data;
    
            if (is_array($object)) {
    Severity: Minor
    Found in src/Rudra.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

    Severity
    Category
    Status
    Source
    Language