private function getRequestDetails(Configuration $config) { $details = array(); if ($build = $config->getBuild()) { $details['collabToken'] = $build->getEnv(); // create a job in the current build $content = json_encode(array('name' => $config->getTitle())); $data = json_decode($this->sendHttpRequest($this->config->getEndpoint() . '/api/v1/build/' . $build->getUuid() . '/jobs', 'POST', array('content' => $content), array('Content-Type: application/json')), true); $build->incJob(); $details['requestId'] = $data['uuid']; } else { $details['collabToken'] = $this->getEnvUuid($this->config->getEnv()); } $id = self::NO_REFERENCE_ID; if ($config->getReference() || $config->isNewReference()) { foreach ($collabToken['profileSlots'] as $profileSlot) { if ($config->isNewReference() && $profileSlot['empty'] && self::NO_REFERENCE_ID !== $profileSlot['id']) { $id = $profileSlot['id']; break; } if ($config->getReference() == $profileSlot['number'] || $config->getReference() == $profileSlot['id']) { $id = $profileSlot['id']; break; } } if (self::NO_REFERENCE_ID === $id) { throw new Exception\ReferenceNotFoundException(sprintf('Unable to find the "%s" reference.', $config->getReference())); } } $details['profileSlot'] = $id; return $details; }