codeclimate/php-test-reporter

View on GitHub
src/TestReporter/ApiClient.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method sendWithCurl has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function sendWithCurl($url, $payload)
    {
        $response = new \stdClass;
        $curl     = curl_init($url);
        curl_setopt($curl, CURLOPT_HEADER, true);
Severity: Minor
Found in src/TestReporter/ApiClient.php - About 1 hr to fix

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

        public function send(Entity\JsonFile $json)
        {
            $response = new \stdClass;
            $payload  = (string)$json;
            $options  = array(
    Severity: Minor
    Found in src/TestReporter/ApiClient.php - About 1 hr to fix

      Remove error control operator '@' on line 50.
      Open

          public function send(Entity\JsonFile $json)
          {
              $response = new \stdClass;
              $payload  = (string)$json;
              $options  = array(
      Severity: Minor
      Found in src/TestReporter/ApiClient.php by phpmd

      ErrorControlOperator

      Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

      Example

      function foo($filePath) {
          $file = @fopen($filPath); // hides exceptions
          $key = @$array[$notExistingKey]; // assigns null to $key
      }

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

      Missing class import via use statement (line '32', column '25').
      Open

              $response = new \stdClass;
      Severity: Minor
      Found in src/TestReporter/ApiClient.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 '76', column '25').
      Open

              $response = new \stdClass;
      Severity: Minor
      Found in src/TestReporter/ApiClient.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 assigning values to variables in if clauses and the like (line '50', column '13').
      Open

          public function send(Entity\JsonFile $json)
          {
              $response = new \stdClass;
              $payload  = (string)$json;
              $options  = array(
      Severity: Minor
      Found in src/TestReporter/ApiClient.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

      Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($foo = 'bar') { // possible typo
                  // ...
              }
              if ($baz = 0) { // always false
                  // ...
              }
          }
      }

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

      There are no issues that match your filters.

      Category
      Status