Mashape/unirest-php

View on GitHub
src/Unirest/Request.php

Summary

Maintainability
D
2 days
Test Coverage

Request has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{
    private static $cookie = null;
    private static $cookieFile = null;
    private static $curlOpts = array();
Severity: Minor
Found in src/Unirest/Request.php - About 4 hrs to fix

File Request.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Unirest;

class Request
Severity: Minor
Found in src/Unirest/Request.php - About 3 hrs to fix

Method send has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
    {
        self::$handle = curl_init();

        if ($method !== Method::GET) {
Severity: Major
Found in src/Unirest/Request.php - About 2 hrs to fix

Function send has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
    {
        self::$handle = curl_init();

        if ($method !== Method::GET) {
Severity: Minor
Found in src/Unirest/Request.php - About 2 hrs 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 buildHTTPCurlQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function buildHTTPCurlQuery($data, $parent = false)
    {
        $result = array();

        if (is_object($data)) {
Severity: Minor
Found in src/Unirest/Request.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

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

    public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 45 mins to fix

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

    public static function connect($url, $headers = array(), $parameters = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function delete($url, $headers = array(), $body = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function put($url, $headers = array(), $body = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function patch($url, $headers = array(), $body = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function options($url, $headers = array(), $parameters = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function get($url, $headers = array(), $parameters = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function head($url, $headers = array(), $parameters = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function trace($url, $headers = array(), $body = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

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

    public static function post($url, $headers = array(), $body = null, $username = null, $password = null)
Severity: Minor
Found in src/Unirest/Request.php - About 35 mins to fix

There are no issues that match your filters.

Category
Status