mikecbrant/php-rest-client

View on GitHub
src/RestClientLib/RestMultiClient.php

Summary

Maintainability
A
0 mins
Test Coverage
A
98%

Avoid using undefined variables such as '$active' which will lead to PHP notices.
Open

            $status = curl_multi_exec($this->curlMultiHandle, $active);
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$active' which will lead to PHP notices.
Open

        } while ($status === CURLM_CALL_MULTI_PERFORM || $active);
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Missing class import via use statement (line '228', column '23').
Open

            throw new \Exception('curl_multi_exec failed with status "' . $status . '"');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '295', column '23').
Open

            throw new \LengthException('The number of actions requested does not match the number of data elements provided.'); 
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '186', column '23').
Open

            throw new \Exception('multi_curl handle failed to initialize.');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '334', column '23').
Open

            throw new \LengthException('Length of data array exceeds maxHandles setting.');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '241', column '27').
Open

                throw new \Exception(
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '310', column '23').
Open

            throw new \InvalidArgumentException('An empty array was passed for actions parameter.');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '331', column '23').
Open

            throw new \InvalidArgumentException('An empty array was passed for data parameter');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '158', column '23').
Open

            throw new \InvalidArgumentException('A non-integer value was passed for max_handles parameter.');     
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '313', column '23').
Open

            throw new \LengthException('Length of actions array exceeds maxHandles setting.');
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid using MikeBrant\RestClientLib\count() function in for loops.
Open

        for ($i = 0; $i < count($data); $i++) {
            $element = $data[$i];
            curl_setopt($this->curlHandles[$i], CURLOPT_POSTFIELDS, $element);
        }
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

Avoid using MikeBrant\RestClientLib\count() function in for loops.
Open

        for ($i = 0; $i < count($actions); $i++) {
            $url = $this->buildUrl($actions[$i]);
            curl_setopt($this->curlHandles[$i], CURLOPT_URL, $url);
        }   
Severity: Minor
Found in src/RestClientLib/RestMultiClient.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

There are no issues that match your filters.

Category
Status