From f369af13581cbb214a61d188ef5f25db72e5b62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Thu, 17 Jul 2014 20:02:23 +0200 Subject: [PATCH] formatted --- .../core/Files/AsynchronousFileReader.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index dd420fd8..27b23479 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -3,7 +3,6 @@ namespace ManiaControl\Files; use cURL\Event; -use cURL\Exception; use cURL\Request; use ManiaControl\ManiaControl; @@ -36,16 +35,28 @@ class AsynchronousFileReader { $this->maniaControl = $maniaControl; } + public static function newRequestTest($url) { + $request = new Request($url); + $request->getOptions() + ->set(CURLOPT_TIMEOUT, 60) + ->set(CURLOPT_HEADER, false) // don't display response header + ->set(CURLOPT_CRLF, true) // linux line feed + ->set(CURLOPT_ENCODING, '') // accept encoding + ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent + ->set(CURLOPT_RETURNTRANSFER, true); // return instead of output content + return $request; + } + /** * Append available Data of active Requests */ public function appendData() { foreach ($this->requests as $key => $request) { - if ($request->socketPerform()) { - $request->socketSelect(); - }else{ - unset($this->requests[$key]); - } + if ($request->socketPerform()) { + $request->socketSelect(); + } else { + unset($this->requests[$key]); + } } } @@ -103,6 +114,8 @@ class AsynchronousFileReader { return $request; } + //TODO remove, they are just for testing dedimania + /** * Add a Request to the queue * @@ -112,19 +125,6 @@ class AsynchronousFileReader { array_push($this->requests, $request); } - //TODO remove, they are just for testing dedimania - public static function newRequestTest($url){ - $request = new Request($url); - $request->getOptions() - ->set(CURLOPT_TIMEOUT, 60) - ->set(CURLOPT_HEADER, false) // don't display response header - ->set(CURLOPT_CRLF, true) // linux line feed - ->set(CURLOPT_ENCODING, '') // accept encoding - ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent - ->set(CURLOPT_RETURNTRANSFER, true); // return instead of output content - return $request; - } - public function postDataTest(Request $request, $url, callable $function, $content, $compression = false, $contentType = 'text/xml; charset=UTF-8;') { @@ -189,7 +189,7 @@ class AsynchronousFileReader { ->set(CURLOPT_POST, true) // post method ->set(CURLOPT_POSTFIELDS, $content) // post content field ->set(CURLOPT_HTTPHEADER, $headers) // headers - ; + ; $request->addListener('complete', function (Event $event) use (&$function) { $error = null; $content = null;