Code Duplication    Length = 5-5 lines in 3 locations

lib/private/Files/View.php 3 locations

@@ 1121-1125 (lines=5) @@
1118
						$result = $storage->$operation($internalPath);
1119
					}
1120
				} catch (\Exception $e) {
1121
					if (in_array('write', $hooks) || in_array('delete', $hooks)) {
1122
						$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1123
					} else if (in_array('read', $hooks)) {
1124
						$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1125
					}
1126
					throw $e;
1127
				}
1128
@@ 1147-1151 (lines=5) @@
1144
				if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
1145
					$unlockLater = true;
1146
					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
1147
						if (in_array('write', $hooks)) {
1148
							$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1149
						} else if (in_array('read', $hooks)) {
1150
							$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1151
						}
1152
					});
1153
				}
1154
@@ 1161-1165 (lines=5) @@
1158
					}
1159
				}
1160
1161
				if (!$unlockLater
1162
					&& (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks))
1163
				) {
1164
					$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1165
				}
1166
				return $result;
1167
			} else {
1168
				$this->unlockFile($path, ILockingProvider::LOCK_SHARED);