@@ -51,6 +51,10 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string $path |
|
| 56 | + * @param string $fileHash |
|
| 57 | + */ |
|
| 54 | 58 | private function initRequest($path, Psr7\Stream $stream, $fileHash, $params) { |
| 55 | 59 | $metaData = array( |
| 56 | 60 | 'expiration' => time() + $this->config->blockExpiration, |
@@ -78,6 +82,9 @@ discard block |
||
| 78 | 82 | return $initInfo; |
| 79 | 83 | } |
| 80 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $blockId |
|
| 87 | + */ |
|
| 81 | 88 | private function blockUpload($blocksInfo, $blockId, Psr7\Stream $stream, $params = []) { |
| 82 | 89 | $startPosition = $blockId * $this->config->maxBlockSize; |
| 83 | 90 | $endPosition = $blockId >= $blocksInfo->blocks - 1 ? $stream->getSize() : $startPosition + $this->config->maxBlockSize; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function __construct(Config $config) { |
| 19 | 19 | $this->config = $config; |
| 20 | 20 | $this->url = ($this->config->useSsl ? 'https://' : 'http://') . Config::ED_FORM . '/'. |
| 21 | - $this->config->bucketName; |
|
| 21 | + $this->config->bucketName; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $multipart = []; |
| 105 | 105 | foreach($postData as $key => $value) { |
| 106 | - $multipart[] = ['name' => $key, 'contents' => $value]; |
|
| 106 | + $multipart[] = ['name' => $key, 'contents' => $value]; |
|
| 107 | 107 | } |
| 108 | 108 | $multipart[] = [ |
| 109 | 109 | 'name' => 'file', |
@@ -16,6 +16,9 @@ discard block |
||
| 16 | 16 | $this->config = $config; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $source |
|
| 21 | + */ |
|
| 19 | 22 | public function process($source, $tasks) { |
| 20 | 23 | $encodedTasks = Util::base64Json($tasks); |
| 21 | 24 | |
@@ -43,6 +46,9 @@ discard block |
||
| 43 | 46 | } |
| 44 | 47 | |
| 45 | 48 | |
| 49 | + /** |
|
| 50 | + * @param string $path |
|
| 51 | + */ |
|
| 46 | 52 | public function query($taskIds, $path) { |
| 47 | 53 | $client = new Client([ |
| 48 | 54 | 'timeout' => $this->config->timeout, |
@@ -29,6 +29,9 @@ discard block |
||
| 29 | 29 | $this->endpoint = Config::$restApiEndPoint . '/' . $config->bucketName; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + /** |
|
| 33 | + * @param string $method |
|
| 34 | + */ |
|
| 32 | 35 | public function request($method, $storagePath) { |
| 33 | 36 | $this->method = strtoupper($method); |
| 34 | 37 | $this->storagePath = '/' . ltrim($storagePath, '/'); |
@@ -37,7 +40,7 @@ discard block |
||
| 37 | 40 | |
| 38 | 41 | |
| 39 | 42 | /** |
| 40 | - * @param string|resource $file |
|
| 43 | + * @param Psr7\Stream $file |
|
| 41 | 44 | * |
| 42 | 45 | * @return $this |
| 43 | 46 | */ |
@@ -49,7 +52,7 @@ discard block |
||
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | /** |
| 52 | - * @return mixed|\Psr\Http\Message\ResponseInterface |
|
| 55 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 53 | 56 | */ |
| 54 | 57 | public function send() { |
| 55 | 58 | $client = new Client([ |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | if(! $useBlock) { |
| 32 | 32 | $req = new Rest($this->config); |
| 33 | 33 | return $req->request('PUT', $path) |
| 34 | - ->withHeaders($params) |
|
| 35 | - ->withFile($stream) |
|
| 36 | - ->send(); |
|
| 34 | + ->withHeaders($params) |
|
| 35 | + ->withFile($stream) |
|
| 36 | + ->send(); |
|
| 37 | 37 | } else { |
| 38 | 38 | return $this->pointUpload($path, $stream, $params); |
| 39 | 39 | } |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | throw new \Exception('form api key is empty.'); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - return $this->formApiKey; |
|
| 114 | + return $this->formApiKey; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function setFormApiKey($key) { |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $callbackParams = array(); |
| 88 | 88 | foreach ($callbackKeys as $key) { |
| 89 | 89 | if (isset($_POST[$key])) { |
| 90 | - $callbackParams[$key] = Util::trim($_POST[$key]); |
|
| 90 | + $callbackParams[$key] = Util::trim($_POST[$key]); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |