Prototype gitea filter

This commit is contained in:
Mateusz Pieła 2021-04-27 09:06:56 +02:00
parent db60346a8c
commit 0daf2494d2
4 changed files with 51 additions and 2 deletions

View file

@ -1,15 +1,19 @@
<?php
namespace classes;
use classes\filter\gitea;
class webhook extends core
{
private $json;
private $filter;
public function __construct(string $json)
public function __construct(string $json,string $filter)
{
parent::__construct();
if($json)
{
$this->filter = $filter ?? NULL;
$this->json = json_decode($json, false);
}
else
@ -20,6 +24,12 @@ class webhook extends core
public function getMessage()
{
if($this->filter === "gitea")
{
$filter = new gitea();
return($filter->formatMessageToReadable($this->json->text));
}
return $this->json->text;
}
}