Completed
Pull Request — master (#30)
by
unknown
03:16
created
src/Request/Queue.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function download($token, $url)
67 67
 	{
68
-		return $this->request($token, function (GuzzleHttp\Client $client) use ($url) {
68
+		return $this->request($token, function(GuzzleHttp\Client $client) use ($url) {
69 69
 			return $client->request('GET', $url, $this->downloadOptions);
70 70
 		}, 'download');
71 71
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		}
84 84
 		$newPost[] = ['name' => 'file', 'contents' => fopen($filename, 'r')];
85 85
 
86
-		$response = $this->request($token, function (GuzzleHttp\Client $client) use ($url, $newPost) {
86
+		$response = $this->request($token, function(GuzzleHttp\Client $client) use ($url, $newPost) {
87 87
 			return $client->request('POST', $url, [GuzzleHttp\RequestOptions::MULTIPART => $newPost]);
88 88
 		}, 'upload');
89 89
 		return self::createXmlResponse($response);
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 					throw $e;
115 115
 				} elseif ($i >= $this->limitLoop) {
116 116
 					fclose($file);
117
-					throw new Fio\QueueLimitException('You have limit up requests to server ' . $this->limitLoop);
117
+					throw new Fio\QueueLimitException('You have limit up requests to server '.$this->limitLoop);
118 118
 				}
119 119
 				self::sleep($tempFile);
120 120
 				$next = true;
121 121
 			} catch (GuzzleHttp\Exception\ServerException $e) {
122
-				if($e->hasResponse()) {
123
-					self::detectDownloadResponse( $e->getResponse() );
122
+				if ($e->hasResponse()) {
123
+					self::detectDownloadResponse($e->getResponse());
124 124
 				}
125 125
 				throw new Fio\ServiceUnavailableException('Service is currently unavailable');
126 126
 			} catch (GuzzleHttp\Exception\ConnectException $e) {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	{
171 171
 		$key = substr($token, 10, -10);
172 172
 		if (!isset(self::$tokens[$key])) {
173
-			self::$tokens[$key] = $this->tempDir . DIRECTORY_SEPARATOR . md5($key);
173
+			self::$tokens[$key] = $this->tempDir.DIRECTORY_SEPARATOR.md5($key);
174 174
 		}
175 175
 
176 176
 		return self::$tokens[$key];
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 	private static function safeProtocol($filename)
180 180
 	{
181
-		return Utils\SafeStream::PROTOCOL . '://' . $filename;
181
+		return Utils\SafeStream::PROTOCOL.'://'.$filename;
182 182
 	}
183 183
 
184 184
 	/**
Please login to merge, or discard this patch.
Doc Comments   +11 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,6 +26,9 @@  discard block
 block discarded – undo
26 26
 	/** @var string */
27 27
 	private $tempDir;
28 28
 
29
+	/**
30
+	 * @param string $tempDir
31
+	 */
29 32
 	public function __construct($tempDir)
30 33
 	{
31 34
 		$this->tempDir = $tempDir;
@@ -60,7 +63,7 @@  discard block
 block discarded – undo
60 63
 	/**
61 64
 	 * @param $token
62 65
 	 * @param string $url
63
-	 * @return mixed|string
66
+	 * @return GuzzleHttp\Psr7\Stream
64 67
 	 * @throws Fio\QueueLimitException
65 68
 	 * @throws Fio\ServiceUnavailableException
66 69
 	 */
@@ -91,7 +94,7 @@  discard block
 block discarded – undo
91 94
 
92 95
 	/**
93 96
 	 * @param $token
94
-	 * @param $fallback
97
+	 * @param \Closure $fallback
95 98
 	 * @param string $action
96 99
 	 * @return GuzzleHttp\Psr7\Stream
97 100
 	 * @throws Fio\QueueLimitException
@@ -154,6 +157,9 @@  discard block
 block discarded – undo
154 157
 		}
155 158
 	}
156 159
 
160
+	/**
161
+	 * @param string $filename
162
+	 */
157 163
 	private static function sleep($filename)
158 164
 	{
159 165
 		$criticalTime = time() - filemtime($filename);
@@ -176,6 +182,9 @@  discard block
 block discarded – undo
176 182
 		return self::$tokens[$key];
177 183
 	}
178 184
 
185
+	/**
186
+	 * @param string $filename
187
+	 */
179 188
 	private static function safeProtocol($filename)
180 189
 	{
181 190
 		return Utils\SafeStream::PROTOCOL . '://' . $filename;
Please login to merge, or discard this patch.
Unused Use Statements   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace h4kuna\Fio\Request;
4 4
 
5
-use GuzzleHttp,
6
-	h4kuna\Fio,
7
-	h4kuna\Fio\Response\Pay,
8
-	Nette\Utils;
5
+use GuzzleHttp;
6
+use h4kuna\Fio;
7
+use h4kuna\Fio\Response\Pay;
8
+use Nette\Utils;
9 9
 use Psr\Http\Message\ResponseInterface;
10 10
 
11 11
 class Queue implements IQueue
Please login to merge, or discard this patch.