summaryrefslogtreecommitdiff
path: root/app/Core/HttpClient.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-04-18 18:44:45 -0400
committerFrederic Guillot <fred@kanboard.net>2015-04-18 18:44:45 -0400
commit370b5a0fd7c1dba60e3b973506ba087adba42be0 (patch)
tree8da109b4fc90062d6eebb69d4ae2efca4da1bac3 /app/Core/HttpClient.php
parentf53bb88d10836e5c31efb958683d8bf3829eecbf (diff)
Add Slack and Hipchat integrations for each projects
Diffstat (limited to 'app/Core/HttpClient.php')
-rw-r--r--app/Core/HttpClient.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/app/Core/HttpClient.php b/app/Core/HttpClient.php
index e1d90858..0803ec7a 100644
--- a/app/Core/HttpClient.php
+++ b/app/Core/HttpClient.php
@@ -2,6 +2,8 @@
namespace Core;
+use Pimple\Container;
+
/**
* HTTP client
*
@@ -32,15 +34,33 @@ 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;
}
}