hnhdigital-os/laravel-frontend-asset-loader

View on GitHub

Showing 13 of 30 total issues

FrontendAsset has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class FrontendAsset
{
    /**
     * The domain for assets.
     *
Severity: Minor
Found in src/FrontendAsset.php - About 3 hrs to fix

    File FrontendAsset.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace HnhDigital\LaravelFrontendAssetLoader;
    
    /*
    Severity: Minor
    Found in src/FrontendAsset.php - About 3 hrs to fix

      Asset has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Asset
      {
          private $path;
          private $content;
          private $location;
      Severity: Minor
      Found in src/Asset.php - About 2 hrs to fix

        Method boot has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function boot()
            {
                $this->publishes([
                    __DIR__.'/../config/config.php' => config_path('hnhdigital/assets.php'),
                ]);
        Severity: Minor
        Found in src/ServiceProvider.php - About 1 hr to fix

          Function parseExtension has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function parseExtension($path, $location = null)
              {
                  $key = null;
          
                  foreach ($this->extension_mapping as $store => $extensions) {
          Severity: Minor
          Found in src/FrontendAsset.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 autoloadAssets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function autoloadAssets($extensions, $path)
              {
                  // Force array.
                  $extensions = Arr::wrap($extensions);
          
          
          Severity: Minor
          Found in src/FrontendAsset.php - About 45 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 autoloadWildcardAssets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function autoloadWildcardAssets($extensions, $path)
              {
                  // Force array.
                  $extensions = Arr::wrap($extensions);
          
          
          Severity: Minor
          Found in src/FrontendAsset.php - About 45 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 renderInline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function renderInline($location)
              {
                  $result = '';
                  $path = $this->path;
          
          
          Severity: Minor
          Found in src/Asset.php - About 45 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/'.$path;
          Severity: Major
          Found in src/FrontendAsset.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

                          return "<?php app('FrontendAsset')->package($name); ?>";
              Severity: Major
              Found in src/ServiceProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return "<?php app('FrontendAsset')->package($name); ?>";
                Severity: Major
                Found in src/ServiceProvider.php - About 30 mins to fix

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

                      public function url($path)
                      {
                          // Detect path points to external url.
                          if (stripos($path, '://') !== false) {
                              return $path;
                  Severity: Minor
                  Found in src/FrontendAsset.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