Page MenuHomeDevCentral

JenkinsGateController.php
No OneTemporary

JenkinsGateController.php

<?php
namespace Nasqueron\Notifications\Http\Controllers\Gate;
use Nasqueron\Notifications\Events\JenkinsPayloadEvent;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Request;
use Symfony\Component\HttpFoundation\Response;
class JenkinsGateController extends GateController {
///
/// Private members
///
/**
* The request content, as a structured data
*
* @var \stdClass
*/
private $payload;
/**
* The request content
*
* @var string
*/
private $rawRequestContent;
///
/// Request processing
///
/**
* Handles POST requests
*
* @param string $door The door, matching the project for this payload
* @return \Symfony\Component\HttpFoundation\Response
*/
public function onPost (string $door) : Response {
// Parses the request and check if it's legit
$this->door = $door;
$this->extractPayload();
// Process the request
$this->logRequest();
$this->onPayload();
// Output
return parent::renderReport();
}
/**
* Extracts payload from the request
*/
protected function extractPayload () {
$request = Request::instance();
$this->rawRequestContent = $request->getContent();
$this->payload = json_decode($this->rawRequestContent);
}
public function getServiceName () : string {
return "Jenkins";
}
///
/// Payload processing
///
protected function onPayload () {
$this->initializeReport();
Event::dispatch(new JenkinsPayloadEvent(
$this->door,
$this->payload
));
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 11, 20:08 (4 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3063919
Default Alt Text
JenkinsGateController.php (1 KB)

Event Timeline