jakeasmith/http_build_url

View on GitHub

Showing 3 of 3 total issues

Function http_build_url has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

    function http_build_url($url, $parts = array(), $flags = HTTP_URL_REPLACE, &$new_url = array())
    {
        is_array($url) || $url = parse_url($url);
        is_array($parts) || $parts = parse_url($parts);

Severity: Minor
Found in src/http_build_url.php - About 1 day 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 http_build_url has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function http_build_url($url, $parts = array(), $flags = HTTP_URL_REPLACE, &$new_url = array())
    {
        is_array($url) || $url = parse_url($url);
        is_array($parts) || $parts = parse_url($parts);

Severity: Major
Found in src/http_build_url.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

    if (!function_exists('http_build_url')) {
    
        /**
         * Build a URL.
         *
    Severity: Major
    Found in src/http_build_url.php - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language