polyfony-inc/polyfony

View on GitHub
Private/Polyfony/Response/HTML.php

Summary

Maintainability
C
1 day
Test Coverage

File HTML.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Polyfony\Response;

use Polyfony\{ 
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 3 hrs to fix

Function packAndMinifyScripts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private static function packAndMinifyScripts() :void {
        // if we are allowed to pack js files
        if(self::isPackingOfTheseAssetsAllowed('js')) {
            // generate a unique name for a pack that contains that list of scripts only
            list(
Severity: Minor
Found in Private/Polyfony/Response/HTML.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 setLinks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function setLinks(
        array $links, 
        bool $replace_existing=false
    ) :void {
        // if we want to purge existing links
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 1 hr to fix

Method packAndMinifyScripts has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function packAndMinifyScripts() :void {
        // if we are allowed to pack js files
        if(self::isPackingOfTheseAssetsAllowed('js')) {
            // generate a unique name for a pack that contains that list of scripts only
            list(
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 1 hr to fix

Function packAndMinifyLinks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function packAndMinifyLinks() :void {
        // if we are allowed to pack js files
        if(self::isPackingOfTheseAssetsAllowed('css')) {
            // now that we have sorted links by type and medias, we can pack them by medias
            foreach(self::getStylesheetsLinksSortedByMedia() as $media => $list_of_stylesheets) {
Severity: Minor
Found in Private/Polyfony/Response/HTML.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 setLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setLinks(
        array $links, 
        bool $replace_existing=false
    ) :void {
        // if we want to purge existing links
Severity: Minor
Found in Private/Polyfony/Response/HTML.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

There are no issues that match your filters.

Category
Status