Add Slack and Hipchat integrations for each projects

This commit is contained in:
Frederic Guillot
2015-04-18 18:44:45 -04:00
parent f53bb88d10
commit 370b5a0fd7
15 changed files with 368 additions and 81 deletions

View File

@@ -2,6 +2,8 @@
namespace Core;
use Pimple\Container;
/**
* HTTP client
*
@@ -31,16 +33,34 @@ class HttpClient
*/
const HTTP_USER_AGENT = 'Kanboard Webhook';
/**
* Container instance
*
* @access protected
* @var \Pimple\Container
*/
protected $container;
/**
* Constructor
*
* @access public
* @param \Pimple\Container $container
*/
public function __construct(Container $container)
{
$this->container = $container;
}
/**
* Send a POST HTTP request
*
* @static
* @access public
* @param string $url
* @param array $data
* @return string
*/
public static function post($url, array $data)
public function post($url, array $data)
{
if (empty($url)) {
return '';
@@ -63,6 +83,14 @@ class HttpClient
)
));
return @file_get_contents(trim($url), false, $context);
$response = @file_get_contents(trim($url), false, $context);
if (DEBUG) {
$this->container['logger']->debug($url);
$this->container['logger']->debug(var_export($data, true));
$this->container['logger']->debug($response);
}
return $response;
}
}