Code Duplication    Length = 5-5 lines in 3 locations

lib/private/files/view.php 3 locations

@@ 1058-1062 (lines=5) @@
1055
						$result = $storage->$operation($internalPath);
1056
					}
1057
				} catch (\Exception $e) {
1058
					if (in_array('write', $hooks) || in_array('delete', $hooks)) {
1059
						$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1060
					} else if (in_array('read', $hooks)) {
1061
						$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1062
					}
1063
					throw $e;
1064
				}
1065
@@ 1084-1088 (lines=5) @@
1081
				if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
1082
					$unlockLater = true;
1083
					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
1084
						if (in_array('write', $hooks)) {
1085
							$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1086
						} else if (in_array('read', $hooks)) {
1087
							$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1088
						}
1089
					});
1090
				}
1091
@@ 1098-1102 (lines=5) @@
1095
					}
1096
				}
1097
1098
				if (!$unlockLater
1099
					&& (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks))
1100
				) {
1101
					$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1102
				}
1103
				return $result;
1104
			} else {
1105
				$this->unlockFile($path, ILockingProvider::LOCK_SHARED);