@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param array $options |
| 69 | - * @param mixed $option |
|
| 69 | + * @param string $option |
|
| 70 | 70 | * @param mixed $default |
| 71 | 71 | * @return array |
| 72 | 72 | */ |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Add prefix for session's key |
| 158 | - * @param $sessionId |
|
| 158 | + * @param string $sessionId |
|
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | 161 | protected function getSessionKey($sessionId) |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * @param $path |
|
| 52 | + * @param string $path |
|
| 53 | 53 | * @param string $filename Filename for saving dialog on the client-side |
| 54 | 54 | * @param bool $forceSaveDialog |
| 55 | 55 | * @return EmptyResponse |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * @return string|null |
|
| 105 | + * @return UploadedFile|null |
|
| 106 | 106 | */ |
| 107 | 107 | protected function upload() |
| 108 | 108 | { |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * @param ResourceDOInterface $resourceDO |
| 121 | - * @param $uri |
|
| 122 | - * @return UploadedFile |
|
| 121 | + * @param string $uri |
|
| 122 | + * @return DownloadedFile |
|
| 123 | 123 | * @throws ErrorException |
| 124 | 124 | * @throws \Exception |
| 125 | 125 | */ |
@@ -131,11 +131,11 @@ |
||
| 131 | 131 | set_time_limit(self::CURL_TIMEOUT); |
| 132 | 132 | $dir = DATA_DIR . 'download' . DIRECTORY_SEPARATOR; |
| 133 | 133 | $file = $this->resourceDO->getUuid() . '_' . time() . '_' . mt_rand(100, 200) . '.tmp'; |
| 134 | - if(!@mkdir($dir) && !is_dir($dir)) { |
|
| 134 | + if (!@mkdir($dir) && !is_dir($dir)) { |
|
| 135 | 135 | throw new ErrorException('Can\'t create the directory: ' . $dir); |
| 136 | 136 | } |
| 137 | 137 | if (is_file($file)) { |
| 138 | - if(!unlink($file)) { |
|
| 138 | + if (!unlink($file)) { |
|
| 139 | 139 | throw new ErrorException('Can\'t remove old file: ' . $dir . $file); |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * @param $directory |
|
| 55 | + * @param string $directory |
|
| 56 | 56 | * @throws SaveResourceErrorException |
| 57 | 57 | * @see \Staticus\Resources\Middlewares\SaveResourceMiddlewareAbstract::createDirectory |
| 58 | 58 | */ |
@@ -96,6 +96,9 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | abstract protected function fillResourceSpecialFields(); |
| 98 | 98 | |
| 99 | + /** |
|
| 100 | + * @param string $name |
|
| 101 | + */ |
|
| 99 | 102 | protected function cleanup($name) |
| 100 | 103 | { |
| 101 | 104 | $name = preg_replace('/\s+/u', ' ', trim(mb_strtolower(rawurldecode((string)$name), 'UTF-8'))); |
@@ -131,6 +134,10 @@ discard block |
||
| 131 | 134 | return $str; |
| 132 | 135 | } |
| 133 | 136 | |
| 137 | + /** |
|
| 138 | + * @param string $name |
|
| 139 | + * @param string $value |
|
| 140 | + */ |
|
| 134 | 141 | protected function defaultValidator($name, $value, $canBeEmpty = false, $allowedRegexpSymbols = '\w\d\-_', $replaceDeniedSymbols = false) |
| 135 | 142 | { |
| 136 | 143 | if (!empty($value)) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * @param $filePath |
|
| 85 | + * @param string $filePath |
|
| 86 | 86 | * @param $content |
| 87 | 87 | */ |
| 88 | 88 | protected function writeFile($filePath, $content) |
@@ -97,6 +97,10 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $mime |
|
| 102 | + * @param string $filePath |
|
| 103 | + */ |
|
| 100 | 104 | protected function uploadFile(UploadedFileInterface $content, $mime, $filePath) |
| 101 | 105 | { |
| 102 | 106 | $uri = $content->getStream()->getMetadata('uri'); |
@@ -123,7 +127,7 @@ discard block |
||
| 123 | 127 | } |
| 124 | 128 | |
| 125 | 129 | /** |
| 126 | - * @param $directory |
|
| 130 | + * @param string $directory |
|
| 127 | 131 | * @throws SaveResourceErrorException |
| 128 | 132 | * @see \Staticus\Resources\Middlewares\Image\ImagePostProcessingMiddlewareAbstract::createDirectory |
| 129 | 133 | */ |
@@ -190,6 +194,9 @@ discard block |
||
| 190 | 194 | } |
| 191 | 195 | abstract protected function afterSave(ResourceDOInterface $resourceDO); |
| 192 | 196 | |
| 197 | + /** |
|
| 198 | + * @return ResourceDOInterface |
|
| 199 | + */ |
|
| 193 | 200 | protected function backup(ResourceDOInterface $resourceDO) |
| 194 | 201 | { |
| 195 | 202 | $command = new BackupResourceCommand($resourceDO, $this->filesystem); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * Put bad files to the 'disk' |
| 10 | 10 | * @param $resourceDO |
| 11 | - * @param $content |
|
| 11 | + * @param string $content |
|
| 12 | 12 | * @return string |
| 13 | 13 | */ |
| 14 | 14 | protected function addWrongFilesToDisk(ResourceDOInterface $resourceDO, $content) |
@@ -44,6 +44,9 @@ discard block |
||
| 44 | 44 | $this->assertTrue($this->filesystem->has($filePath)); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + /** |
|
| 48 | + * @param \Staticus\Resources\File\ResourceDO $resourceDO |
|
| 49 | + */ |
|
| 47 | 50 | protected function assertWrongFilesIsStillHere($resourceDO) |
| 48 | 51 | { |
| 49 | 52 | $resourceDO = clone $resourceDO; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @return BackupResourceCommand |
|
| 27 | + * @return CopyResourceCommand |
|
| 28 | 28 | */ |
| 29 | 29 | public function getCommand(ResourceDO $resourceDOSource, ResourceDO $resourceDODest) |
| 30 | 30 | { |