travi/php-framework

View on GitHub
php/framework/src/travi/framework/dependencyManagement/DependencyManager.php

Summary

Maintainability
D
2 days
Test Coverage

DependencyManager has 54 functions (exceeds 20 allowed). Consider refactoring.
Open

class DependencyManager
{
    const SITE_THEME_KEY          = 'siteTheme';
    const SITE_THEME_ENHANCED_KEY = 'siteThemeEnhanced';
    const THIS_PAGE_KEY           = 'thisPage';

    File DependencyManager.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace travi\framework\dependencyManagement;
    
    use travi\framework\utilities\FileSystem,

      Function addDependencies has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addDependencies($dependencies = array(), $component = null)
          {
              if ($this->environment->isProduction() && !empty($dependencies['production'])) {
                  $this->addDependencies($dependencies['production']);
              }

      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 addDependencies has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addDependencies($dependencies = array(), $component = null)
          {
              if ($this->environment->isProduction() && !empty($dependencies['production'])) {
                  $this->addDependencies($dependencies['production']);
              }

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

            public function addCacheBusters()
            {
                foreach ($this->requirementLists as $key => $list) {
                    if ($key === self::CSS_LIST || $key === self::JS_LIST) {
                        foreach ($list as $index => $dependency) {

        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 mapDependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function mapDependencies($dependencies)
            {
                if (!empty($dependencies['jsDependencies'])) {
                    foreach ($dependencies['jsDependencies'] as $dependency) {
                        $this->addJavaScript($dependency);

        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 resolveComponentDependencies has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resolveComponentDependencies($component)
            {
                if (is_object($component) && is_a($component, 'travi\\framework\\DependantObject')) {
                    $this->addDependencies($component->getDependencies(), $component);
                } else if (is_array($component)) { //TODO: need to make this DRY

        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