Prototype gitea filter
This commit is contained in:
parent
db60346a8c
commit
0daf2494d2
4 changed files with 51 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue