herpaderpaldent/seat-groups

View on GitHub
src/Actions/SeatGroups/GetChangelog.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 22.07.2018
* Time: 16:04.
*/
 
namespace Herpaderpaldent\Seat\SeatGroups\Actions\SeatGroups;
 
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Parsedown;
 
class GetChangelog
{
public function execute()
{
try {
$response = (new Client())
->request('GET', 'https://raw.githubusercontent.com/herpaderpaldent/seat-groups/master/CHANGELOG.md');
if ($response->getStatusCode() != 200) {
return 'Error while fetching changelog';
}
$parser = new Parsedown();
 
return $parser->parse($response->getBody());
} catch (RequestException $e) {
return 'Error while fetching changelog';
}
}
}