diff options
Diffstat (limited to 'app/Core')
-rw-r--r-- | app/Core/HttpClient.php | 34 |
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; } } |