@@ -32,21 +32,21 @@ discard block |
||
| 32 | 32 | $this->temp = $temp ?: sys_get_temp_dir(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param string $name Configured account name from AccountCollection |
|
| 37 | - * @return Fio\FioRead |
|
| 38 | - * @throws Fio\AccountException |
|
| 39 | - */ |
|
| 35 | + /** |
|
| 36 | + * @param string $name Configured account name from AccountCollection |
|
| 37 | + * @return Fio\FioRead |
|
| 38 | + * @throws Fio\AccountException |
|
| 39 | + */ |
|
| 40 | 40 | public function createFioRead($name = null) |
| 41 | 41 | { |
| 42 | 42 | return new Fio\FioRead($this->getQueue(), $this->getAccount($name), $this->createReader()); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param string $name Configured account name from AccountCollection |
|
| 47 | - * @return Fio\FioPay |
|
| 48 | - * @throws Fio\AccountException |
|
| 49 | - */ |
|
| 45 | + /** |
|
| 46 | + * @param string $name Configured account name from AccountCollection |
|
| 47 | + * @return Fio\FioPay |
|
| 48 | + * @throws Fio\AccountException |
|
| 49 | + */ |
|
| 50 | 50 | public function createFioPay($name = null) |
| 51 | 51 | { |
| 52 | 52 | return new Fio\FioPay( |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | return new Fio\Request\Queue($this->temp); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @param array $accounts |
|
| 68 | - * @return Fio\Account\AccountCollection |
|
| 69 | - * @throws Fio\AccountException |
|
| 70 | - */ |
|
| 71 | - protected function createAccountCollection(array $accounts) |
|
| 66 | + /** |
|
| 67 | + * @param array $accounts |
|
| 68 | + * @return Fio\Account\AccountCollection |
|
| 69 | + * @throws Fio\AccountException |
|
| 70 | + */ |
|
| 71 | + protected function createAccountCollection(array $accounts) |
|
| 72 | 72 | { |
| 73 | 73 | return Fio\Account\AccountCollectionFactory::create($accounts); |
| 74 | 74 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | return $this->accountCollection; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @param string $name Configured account name from AccountCollection |
|
| 83 | - * @return Fio\Account\FioAccount |
|
| 84 | - * @throws Fio\AccountException |
|
| 85 | - */ |
|
| 81 | + /** |
|
| 82 | + * @param string $name Configured account name from AccountCollection |
|
| 83 | + * @return Fio\Account\FioAccount |
|
| 84 | + * @throws Fio\AccountException |
|
| 85 | + */ |
|
| 86 | 86 | final protected function getAccount($name) |
| 87 | 87 | { |
| 88 | 88 | if ($name) { |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | }, 'download'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @return Pay\IResponse |
|
| 75 | - * @throws Fio\QueueLimitException |
|
| 76 | - * @throws Fio\ServiceUnavailableException |
|
| 77 | - */ |
|
| 73 | + /** |
|
| 74 | + * @return Pay\IResponse |
|
| 75 | + * @throws Fio\QueueLimitException |
|
| 76 | + * @throws Fio\ServiceUnavailableException |
|
| 77 | + */ |
|
| 78 | 78 | public function upload($url, $token, array $post, $filename) |
| 79 | 79 | { |
| 80 | 80 | $newPost = []; |
@@ -119,11 +119,11 @@ discard block |
||
| 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() ); |
|
| 124 | - } |
|
| 125 | - throw new Fio\ServiceUnavailableException('Service is currently unavailable'); |
|
| 126 | - } |
|
| 122 | + if($e->hasResponse()) { |
|
| 123 | + self::detectDownloadResponse( $e->getResponse() ); |
|
| 124 | + } |
|
| 125 | + throw new Fio\ServiceUnavailableException('Service is currently unavailable'); |
|
| 126 | + } |
|
| 127 | 127 | } while ($next); |
| 128 | 128 | fclose($file); |
| 129 | 129 | touch($tempFile); |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | return $response->getBody(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * @param $response |
|
| 140 | - * @throws Fio\ServiceUnavailableException |
|
| 141 | - */ |
|
| 142 | - private static function detectDownloadResponse($response) |
|
| 138 | + /** |
|
| 139 | + * @param $response |
|
| 140 | + * @throws Fio\ServiceUnavailableException |
|
| 141 | + */ |
|
| 142 | + private static function detectDownloadResponse($response) |
|
| 143 | 143 | { |
| 144 | 144 | /* @var $contentTypeHeaders array */ |
| 145 | 145 | $contentTypeHeaders = $response->getHeader('Content-Type'); |
@@ -65,7 +65,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | $key = substr($token, 10, -10); |
| 170 | 170 | if (!isset(self::$tokens[$key])) { |
| 171 | - self::$tokens[$key] = $this->tempDir . DIRECTORY_SEPARATOR . md5($key); |
|
| 171 | + self::$tokens[$key] = $this->tempDir.DIRECTORY_SEPARATOR.md5($key); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return self::$tokens[$key]; |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | private static function safeProtocol($filename) |
| 178 | 178 | { |
| 179 | - return Utils\SafeStream::PROTOCOL . '://' . $filename; |
|
| 179 | + return Utils\SafeStream::PROTOCOL.'://'.$filename; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |