antaresproject/core

View on GitHub
src/utils/asset/src/Asset.php

Summary

Maintainability
C
7 hrs
Test Coverage

Function requireJs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function requireJs()
    {
        $scripts = $this->dispatcher->scripts('script', $this->assets, $this->path);

        $required = [];
Severity: Minor
Found in src/utils/asset/src/Asset.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 add has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function add($name, $source, $dependencies = [], $attributes = [], $replaces = [])
    {
        if (!is_null($from      = array_get($attributes, 'from')) && !is_null($extension = extensions($from))) {
            $extensions = app('antares.extension')->getAvailableExtensions();
            $path       = null;
Severity: Minor
Found in src/utils/asset/src/Asset.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 webpack has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function webpack()
    {

        $scripts = array_merge(['/packages/core/js/on-load.js', '/packages/core/js/datatable-helpers.js'], $this->dispatcher->scripts('script', $this->assets, $this->path));

Severity: Minor
Found in src/utils/asset/src/Asset.php - About 1 hr to fix

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

        public function webpack()
        {
    
            $scripts = array_merge(['/packages/core/js/on-load.js', '/packages/core/js/datatable-helpers.js'], $this->dispatcher->scripts('script', $this->assets, $this->path));
    
    
    Severity: Minor
    Found in src/utils/asset/src/Asset.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

    Method register has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function register($type, $name, $source, $dependencies, $attributes, $replaces)
    Severity: Minor
    Found in src/utils/asset/src/Asset.php - About 45 mins to fix

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

          public function style($name, $source, $dependencies = [], $attributes = [], $replaces = [])
      Severity: Minor
      Found in src/utils/asset/src/Asset.php - About 35 mins to fix

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

            public function script($name, $source, $dependencies = [], $attributes = [], $replaces = [])
        Severity: Minor
        Found in src/utils/asset/src/Asset.php - About 35 mins to fix

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

              public function inlineScript($name, $source = null, $dependencies = [], $attributes = [], $replaces = [])
          Severity: Minor
          Found in src/utils/asset/src/Asset.php - About 35 mins to fix

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

                public function add($name, $source, $dependencies = [], $attributes = [], $replaces = [])
            Severity: Minor
            Found in src/utils/asset/src/Asset.php - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status