function setStatus(\NamelessCoder\Gizzle\Payload $payload, \Milo\Github\Api $api, $state, $buildNumber) { $token = $api->getToken(); $head = $payload->getHead(); if (TRUE === empty($token) || TRUE === empty($head)) { return; } $url = sprintf('/repos/%s/%s/statuses/%s', $payload->getRepository()->getOwner()->getName(), $payload->getRepository()->getName(), $head->getId()); switch ($state) { case 'pending': $description = 'Waiting to hear from Gizzle...'; break; case 'success': $description = 'Gizzle build was successful!'; break; case 'error': $description = 'Gizzle reported an error!'; break; case 'failure': $description = 'Gizzle was unable to run the build!'; break; default: } $data = array('state' => $state, 'target_url' => 'http://github.com/NamelessCoder/gizzle', 'context' => $payload->getRepository()->getFullName() . '-gizzle-build-' . $buildNumber, 'description' => $description); $api->post($url, $data); }
/** * @return string */ public function getPanel() { $user = $this->user; $token = $this->api->getToken(); $client = $this->api->getClient(); if ($this->rateLimit) { $freshLimit = TRUE; $rateLimit = $this->rateLimit; } elseif ($this->session->rateLimit) { $freshLimit = FALSE; $rateLimit = $this->session->rateLimit; } else { $freshLimit = FALSE; $rateLimit = NULL; } $messages = $this->messages; ob_start(); require __DIR__ . '/Panel.phtml'; return ob_get_clean(); }