Пример #1
0
 /**
  * @param string $repo
  * @param string $branch
  * @return Response
  */
 protected function getQueueLocation($repo, $branch)
 {
     $header = $this->getCrumbHeader();
     $post = new EntityEnclosingRequest('POST', $this->buildUrl, [$header]);
     $post->setAuth($this->username, $this->passkey)->setPath('/job/' . $repo . '/buildWithParameters/api/xml')->setPostField('BUILD_TYPE', $branch);
     try {
         return $this->httpClient->send($post);
     } catch (ClientErrorResponseException $e) {
         $response = $e->getResponse();
         switch ($response->getStatusCode()) {
             case 404:
                 throw new \InvalidArgumentException("Repository '{$repo}' not found");
             default:
                 throw new $e();
         }
     }
 }