antaresproject/core

View on GitHub
src/foundation/src/helpers.php

Summary

Maintainability
C
1 day
Test Coverage

File helpers.php has 470 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Part of the Antares package.
 *
Severity: Minor
Found in src/foundation/src/helpers.php - About 7 hrs to fix

    Function wrap_html has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        function wrap_html($str, $size = 50, $splitter = '<br />')
        {
            $html   = false;
            $i      = 0;
            $chars  = str_split($str);
    Severity: Minor
    Found in src/foundation/src/helpers.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 wrap_html has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function wrap_html($str, $size = 50, $splitter = '<br />')
        {
            $html   = false;
            $i      = 0;
            $chars  = str_split($str);
    Severity: Minor
    Found in src/foundation/src/helpers.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

                  return asset($logoPath . 'logo_default_tear.png');
      Severity: Major
      Found in src/foundation/src/helpers.php - About 30 mins to fix

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

            function extensions($name = null)
            {
                $extensions = app('antares.memory')->make('component')->get('extensions.active');
                $return     = [];
                if (empty($extensions)) {
        Severity: Minor
        Found in src/foundation/src/helpers.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 brand_logo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            function brand_logo($param = 'logo', $default = null)
            {
                $registry = app('antares.memory')->make('registry');
                $logoPath = config('antares/brands::logo.default_path');
        
        
        Severity: Minor
        Found in src/foundation/src/helpers.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

        There are no issues that match your filters.

        Category
        Status