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

34 lines
614 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
* @param string $url URL to call
* @param array $task Task data
*/
public function notify($url, array $task)
{
2015-01-16 14:23:05 +01:00
$token = $this->config->get('webhook_token');
2014-10-22 19:59:09 +02:00
if (strpos($url, '?') !== false) {
2015-01-16 14:23:05 +01:00
$url .= '&token='.$token;
2014-10-22 19:59:09 +02:00
}
else {
2015-01-16 14:23:05 +01:00
$url .= '?token='.$token;
2014-10-22 19:59:09 +02:00
}
2015-04-21 17:56:16 +02:00
return $this->httpClient->post($url, $task);
2014-10-22 19:59:09 +02:00
}
}