Code Duplication    Length = 5-5 lines in 3 locations

lib/private/Files/View.php 3 locations

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