diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-05 14:19:07 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-05 14:19:07 -0400 |
commit | a08339059b06bcfb673b13a380b6f199abfb5983 (patch) | |
tree | 81638ec619684f04d9b5676bea1f73e1a2197cd1 /app/Job | |
parent | f48e5456312ddb366f9b623cd97b0e740fe99d9e (diff) |
Improve background workers
Diffstat (limited to 'app/Job')
-rw-r--r-- | app/Job/HttpAsyncJob.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/Job/HttpAsyncJob.php b/app/Job/HttpAsyncJob.php new file mode 100644 index 00000000..9e5cf107 --- /dev/null +++ b/app/Job/HttpAsyncJob.php @@ -0,0 +1,43 @@ +<?php + +namespace Kanboard\Job; + +/** + * Async HTTP Client (fire and forget) + * + * @package Kanboard\Job + * @author Frederic Guillot + */ +class HttpAsyncJob extends BaseJob +{ + /** + * Set job parameters + * + * @access public + * @param string $method + * @param string $url + * @param string $content + * @param array $headers + * @return $this + */ + public function withParams($method, $url, $content, array $headers) + { + $this->jobParams = array($method, $url, $content, $headers); + return $this; + } + + /** + * Set job parameters + * + * @access public + * @param string $method + * @param string $url + * @param string $content + * @param array $headers + * @return $this + */ + public function execute($method, $url, $content, array $headers) + { + $this->httpClient->doRequest($method, $url, $content, $headers); + } +} |