hnhdigital-os/laravel-resources-loader

View on GitHub

Showing 7 of 83 total issues

Function controller has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function controller($file_extensions, $file)
    {
        // Only look in a single file extension folder.
        if (!is_array($file_extensions)) {
            $file_extensions = [$file_extensions];
Severity: Minor
Found in src/Resource.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

Function loadFile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFile($file_name, $extension, $full_path = '')
    {
        if (array_has(config('rev-manifest', []), $file_name) || (!empty($full_path) && file_exists($full_path))) {
            if (env('APP_ASSET_INLINE', false)) {
                if (!isset($this->loaded_inline[$full_path])) {
Severity: Minor
Found in src/Resource.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 controller has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function controller($file_extensions, $file)
    {
        // Only look in a single file extension folder.
        if (!is_array($file_extensions)) {
            $file_extensions = [$file_extensions];
Severity: Minor
Found in src/Resource.php - About 1 hr to fix

    Function elixir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function elixir($file)
        {
            if (substr($file, 0, 4) === 'http') {
                return $file;
            }
    Severity: Minor
    Found in src/Resource.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 '/assets/'.$file;
    Severity: Major
    Found in src/Resource.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return '';
      Severity: Major
      Found in src/Resource.php - About 30 mins to fix

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

            private static function loadContainer($class_settings, $config = [])
            {
                if (is_array($class_settings)) {
                    $asset_name = array_shift($class_settings);
                } else {
        Severity: Minor
        Found in src/Resource.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