1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Model/Webhook.php

37 lines
696 B
PHP
Raw Normal View History

2014-10-22 19:59:09 +02:00
<?php
namespace Model;
/**
* Webhook model
*
* @package model
* @author Frederic Guillot
*/
class Webhook extends Base
{
/**
* Call the external URL
*
* @access public
2015-08-16 17:04:56 +02:00
* @param array $values Event payload
2014-10-22 19:59:09 +02:00
*/
2015-08-16 17:04:56 +02:00
public function notify(array $values)
2014-10-22 19:59:09 +02:00
{
2015-08-16 17:04:56 +02:00
$url = $this->config->get('webhook_url');
2015-01-16 14:23:05 +01:00
$token = $this->config->get('webhook_token');
2015-08-16 17:04:56 +02:00
if (! empty($url)) {
2014-10-22 19:59:09 +02:00
2015-08-16 17:04:56 +02:00
if (strpos($url, '?') !== false) {
$url .= '&token='.$token;
}
else {
$url .= '?token='.$token;
}
return $this->httpClient->postJson($url, $values);
}
2014-10-22 19:59:09 +02:00
}
}