Code Duplication    Length = 5-5 lines in 3 locations

lib/private/Files/View.php 3 locations

@@ 1103-1107 (lines=5) @@
1100
						$result = $storage->$operation($internalPath);
1101
					}
1102
				} catch (\Exception $e) {
1103
					if (in_array('write', $hooks) || in_array('delete', $hooks)) {
1104
						$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1105
					} else if (in_array('read', $hooks)) {
1106
						$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1107
					}
1108
					throw $e;
1109
				}
1110
@@ 1129-1133 (lines=5) @@
1126
				if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
1127
					$unlockLater = true;
1128
					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
1129
						if (in_array('write', $hooks)) {
1130
							$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1131
						} else if (in_array('read', $hooks)) {
1132
							$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1133
						}
1134
					});
1135
				}
1136
@@ 1143-1147 (lines=5) @@
1140
					}
1141
				}
1142
1143
				if (!$unlockLater
1144
					&& (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks))
1145
				) {
1146
					$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1147
				}
1148
				return $result;
1149
			} else {
1150
				$this->unlockFile($path, ILockingProvider::LOCK_SHARED);