Completed
Push — 3.0 ( bff830...62cd67 )
by Olivier
06:14
created
lib/Block/EditBlock.php 3 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -11,13 +11,10 @@
 block discarded – undo
11 11
 
12 12
 namespace Icybee\Modules\Files\Block;
13 13
 
14
-use ICanBoogie\I18n;
15 14
 use ICanBoogie\Operation;
16
-
17 15
 use Brickrouge\Element;
18 16
 use Brickrouge\Document;
19 17
 use Brickrouge\Form;
20
-
21 18
 use Icybee\Modules\Files as Root;
22 19
 use Icybee\Modules\Files\File;
23 20
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 
61 61
 				Element::CHILDREN => [
62 62
 
63
-					$this->t('The folder %folder is not writable !', [ '%folder' => $folder ])
63
+					$this->t('The folder %folder is not writable !', ['%folder' => $folder])
64 64
 
65 65
 				]
66 66
 			];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@
 block discarded – undo
75 75
 			try
76 76
 			{
77 77
 				$path = $this->record->pathname->relative;
78
-			}
79
-			catch (\Exception $e)
78
+			} catch (\Exception $e)
80 79
 			{
81 80
 				#
82 81
 				# the associated file might have disappeared
Please login to merge, or discard this patch.
lib/Hooks.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 class Hooks
20 20
 {
21 21
 	/**
22
-	 * @param Core|Binding\CoreBindings $app
22
+	 * @param Core $app
23 23
 	 *
24 24
 	 * @return FileStorageIndex
25 25
 	 */
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	/**
34
-	 * @param Core|Binding\CoreBindings $app
34
+	 * @param Core $app
35 35
 	 *
36 36
 	 * @return FileStorage
37 37
 	 */
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 namespace Icybee\Modules\Files;
13 13
 
14 14
 use ICanBoogie\Core;
15
-
16 15
 use Icybee\Modules\Files\Storage\FileStorage;
17 16
 use Icybee\Modules\Files\Storage\FileStorageIndex;
18 17
 
Please login to merge, or discard this patch.
lib/Operation/SaveOperation.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use ICanBoogie\Errors;
15 15
 use ICanBoogie\HTTP\Request;
16 16
 use ICanBoogie\HTTP\File as HTTPFile;
17
-
18 17
 use Icybee\Modules\Files\File;
19 18
 use Icybee\Modules\Files\Module;
20 19
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 			if (!$file)
123 123
 			{
124
-				$this->response->errors->add(File::HTTP_FILE, "Invalid or deleted file: %pathname", [ 'pathname' => $path ]);
124
+				$this->response->errors->add(File::HTTP_FILE, "Invalid or deleted file: %pathname", ['pathname' => $path]);
125 125
 			}
126 126
 		}
127 127
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 
159 159
 			if ($max_file_size && $max_file_size < $file->size)
160 160
 			{
161
-				$error_message = $errors->format("Maximum file size is :size Mb", [ ':size' => round($max_file_size / 1024) ]);
161
+				$error_message = $errors->format("Maximum file size is :size Mb", [':size' => round($max_file_size / 1024)]);
162 162
 			}
163 163
 
164 164
 			if ($this->accept && !$file->match($this->accept))
165 165
 			{
166
-				$error_message = $errors->format("Only the following file types are accepted: %accepted.", [ '%accepted' => implode(', ', $this->accept) ]);
166
+				$error_message = $errors->format("Only the following file types are accepted: %accepted.", ['%accepted' => implode(', ', $this->accept)]);
167 167
 			}
168 168
 
169 169
 			if ($error_message)
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,8 +114,7 @@  discard block
 block discarded – undo
114 114
 			$pathname = \ICanBoogie\REPOSITORY . 'tmp' . DIRECTORY_SEPARATOR . $filename;
115 115
 
116 116
 			$file->move($pathname);
117
-		}
118
-		else if ($path && strpos($path, \ICanBoogie\strip_root(\ICanBoogie\REPOSITORY . "files")) !== 0)
117
+		} else if ($path && strpos($path, \ICanBoogie\strip_root(\ICanBoogie\REPOSITORY . "files")) !== 0)
119 118
 		{
120 119
 			$file = $this->resolve_request_file_from_pathname($path);
121 120
 
@@ -175,8 +174,7 @@  discard block
 block discarded – undo
175 174
 
176 175
 				]);
177 176
 			}
178
-		}
179
-		else if (!$this->key)
177
+		} else if (!$this->key)
180 178
 		{
181 179
 			$errors->add(File::HTTP_FILE, "File is required.");
182 180
 		}
Please login to merge, or discard this patch.
lib/Routing/FilesAdminController.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,6 @@
 block discarded – undo
12 12
 namespace Icybee\Modules\Files\Routing;
13 13
 
14 14
 use ICanBoogie\HTTP\FileResponse;
15
-use ICanBoogie\HTTP\Request;
16
-
17 15
 use Icybee\Modules\Files\Binding\CoreBindings;
18 16
 use Icybee\Modules\Files\File;
19 17
 use Icybee\Modules\Files\FileModel;
Please login to merge, or discard this patch.
lib/Routing/FilesController.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -12,12 +12,10 @@
 block discarded – undo
12 12
 namespace Icybee\Modules\Files\Routing;
13 13
 
14 14
 use ICanBoogie\HTTP\FileResponse;
15
-use ICanBoogie\HTTP\Request;
16 15
 use ICanBoogie\Routing\Controller;
17 16
 use ICanBoogie\Binding\Routing\ControllerBindings;
18 17
 use ICanBoogie\Binding\Routing\ForwardUndefinedPropertiesToApplication;
19 18
 use ICanBoogie\Module\ControllerBindings as ModuleBindings;
20
-
21 19
 use Icybee\Modules\Files\Binding\CoreBindings;
22 20
 use Icybee\Modules\Files\File;
23 21
 
Please login to merge, or discard this patch.
lib/Storage/FileStorage.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 	 *
106 106
 	 * If a file has no reference left it is deleted.
107 107
 	 *
108
-	 * @param $key_or_id_or_uuid_or_hash
108
+	 * @param string $key_or_id_or_uuid_or_hash
109 109
 	 */
110 110
 	public function release($key_or_id_or_uuid_or_hash)
111 111
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		$this->assert_hash_is_used($hash);
71 71
 
72
-		$key = IndexKey::from([ $nid, $uuid, $hash ]);
72
+		$key = IndexKey::from([$nid, $uuid, $hash]);
73 73
 
74 74
 		$this->index->add($key);
75 75
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	{
205 205
 		$hash = $hash ?: $this->hash($pathname);
206 206
 
207
-		return Pathname::from([ $this->root, $hash ]);
207
+		return Pathname::from([$this->root, $hash]);
208 208
 	}
209 209
 
210 210
 	/**
Please login to merge, or discard this patch.
lib/Storage/FileStorageIndex.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
 	/**
119 119
 	 * Deletes key(s) from the index.
120 120
 	 *
121
-	 * @param IndexKey|int|string $key_or_id_or_uuid_or_hash
121
+	 * @param IndexKey $key_or_id_or_uuid_or_hash
122 122
 	 *
123 123
 	 * @throws \InvalidArgumentException if `$key_or_id_or_uuid_or_hash` is not of the expected type.
124 124
 	 */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
 	{
174 174
 		$pathname = $this->root . $key;
175 175
 
176
-		return file_exists($pathname) ? [ $key ] : null;
176
+		return file_exists($pathname) ? [$key] : null;
177 177
 	}
178 178
 
179 179
 	/**
Please login to merge, or discard this patch.
lib/Storage/IndexKey.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 	 *
70 70
 	 * @param string $key
71 71
 	 *
72
-	 * @return array
72
+	 * @return string[]
73 73
 	 */
74 74
 	static private function parse_key($key)
75 75
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$encoded_uuid = substr($key, self::ENCODED_ID_LENGTH + 1, self::ENCODED_UUID_LENGTH);
78 78
 		$hash = substr($key, self::ENCODED_ID_LENGTH + 1 + self::ENCODED_UUID_LENGTH + 1);
79 79
 
80
-		return [ $encoded_id, $encoded_uuid, $hash ];
80
+		return [$encoded_id, $encoded_uuid, $hash];
81 81
 	}
82 82
 
83 83
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			throw new \LogicException("Invalid UUID: $uuid.");
133 133
 		}
134 134
 
135
-		return Base64::encode_unpadded(hex2bin(strtr($uuid, [ '-' => '' ])));
135
+		return Base64::encode_unpadded(hex2bin(strtr($uuid, ['-' => ''])));
136 136
 	}
137 137
 
138 138
 	/**
Please login to merge, or discard this patch.
descriptor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
 			Model::EXTENDING => 'nodes',
28 28
 			Model::SCHEMA => [
29 29
 
30
-				'size' => [ 'integer', 'unsigned' => true ],
31
-				'mime' => [ 'varchar', 'charset' => 'ascii/general_ci' ],
32
-				'extension' => [ 'varchar', 16, 'charset' => 'ascii/general_ci' ],
30
+				'size' => ['integer', 'unsigned' => true],
31
+				'mime' => ['varchar', 'charset' => 'ascii/general_ci'],
32
+				'extension' => ['varchar', 16, 'charset' => 'ascii/general_ci'],
33 33
 				'description' => 'text'
34 34
 
35 35
 			]
Please login to merge, or discard this patch.