lib/Http/Client.php
function uploadJob(Job $job): void {
    if (!$job->getRepoToken() && !$job->getServiceName())
      throw new \InvalidArgumentException('The job does not meet the requirements.');

    $uri = UriResolver::resolve($this->getEndPoint(), new Uri('jobs'));
    $body = new MultipartStream([[
      'contents' => json_encode($job, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
      'filename' => 'coveralls.json',
      'name' => 'json_file'
    ]]);

    $headers = [
      'content-length' => $body->getSize(),
      'content-type' => "multipart/form-data; boundary={$body->getBoundary()}"
    ];

    try {
      $request = new Request('POST', $uri, $headers, $body);
      $this->emit(new RequestEvent($request));

      $response = (new HTTPClient())->send($request);
      $this->emit(new ResponseEvent($request, $response));
    }

    catch (\Throwable $e) {
      throw new ClientException('An error occurred while uploading the report.', $uri, $e);
    }
  }
function uploadJob(Job $job): void {
    if (!$job->getRepoToken() && !$job->getServiceName())
      throw new \InvalidArgumentException('The job does not meet the requirements.');

    $uri = UriResolver::resolve($this->getEndPoint(), new Uri('jobs'));
    $body = new MultipartStream([[
      'contents' => json_encode($job, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
      'filename' => 'coveralls.json',
      'name' => 'json_file'
    ]]);

    $headers = [
      'content-length' => $body->getSize(),
      'content-type' => "multipart/form-data; boundary={$body->getBoundary()}"
    ];

    try {
      $request = new Request('POST', $uri, $headers, $body);
      $this->emit(new RequestEvent($request));

      $response = (new HTTPClient())->send($request);
      $this->emit(new ResponseEvent($request, $response));
    }

    catch (\Throwable $e) {
      throw new ClientException('An error occurred while uploading the report.', $uri, $e);
    }
  }
function uploadJob ( Job $ job ) : void { if ( ! $ job -> getRepoToken ( ) && ! $ job -> getServiceName ( ) ) throw new \ InvalidArgumentException ( 'The job does not meet the requirements.' ) ; $ uri = UriResolver :: resolve ( $ this -> getEndPoint ( ) , new Uri ( 'jobs' ) ) ; $ body = new MultipartStream ( [ [ 'contents' => json_encode ( $ job , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) , 'filename' => 'coveralls.json' , 'name' => 'json_file' ] ] ) ; $ headers = [ 'content-length' => $ body -> getSize ( ) , 'content-type' => "multipart/form-data; boundary={$body->getBoundary()}" ] ; try { $ request = new Request ( 'POST' , $ uri , $ headers , $ body ) ; $ this -> emit ( new RequestEvent ( $ request ) ) ; $ response = ( new HTTPClient ( ) ) -> send ( $ request ) ; $ this -> emit ( new ResponseEvent ( $ request , $ response ) ) ; } catch ( \ Throwable $ e ) { throw new ClientException ( 'An error occurred while uploading the report.' , $ uri , $ e ) ; } }
Uploads the specified job to the Coveralls service.
@param Job $job The job to be uploaded.
@throws \InvalidArgumentException The job does not meet the requirements.
@throws ClientException An error occurred while uploading the report.
Uploads the specified job to the Coveralls service .