Code Duplication    Length = 5-5 lines in 3 locations

lib/private/Files/View.php 3 locations

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