@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * @param Vault[] $vaults |
|
157 | + * @param \Traversable $vaults |
|
158 | 158 | * @param string $lockName |
159 | 159 | */ |
160 | 160 | protected function acquireLocks(\Traversable $vaults, string $lockName) |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | - * @param Vault[] $vaults |
|
172 | + * @param \Traversable $vaults |
|
173 | 173 | * @param string $lockName |
174 | 174 | */ |
175 | 175 | protected function releaseLocks(\Traversable $vaults, string $lockName) |
@@ -183,6 +183,10 @@ discard block |
||
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | + /** |
|
187 | + * @param null|integer $revision |
|
188 | + * @param null|string $vaultTitle |
|
189 | + */ |
|
186 | 190 | protected function getVaultForDownload(?int $revision, ?string $vaultTitle): ?Vault |
187 | 191 | { |
188 | 192 | $revision = $revision ?: $this->getLastRevision(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | public function restore(int $toRevision = null, string $fromVault = null, SynchronizationProgressListenerInterface $progressListener = null): OperationResultList |
118 | 118 | { |
119 | - $this->getLogger()->notice(sprintf("Restoring from %s...", $toRevision ? "r{$toRevision}": 'latest revision')); |
|
119 | + $this->getLogger()->notice(sprintf("Restoring from %s...", $toRevision ? "r{$toRevision}" : 'latest revision')); |
|
120 | 120 | |
121 | 121 | $vault = $this->getVaultForDownload($toRevision, $fromVault); |
122 | 122 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function dump(string $targetPath, int $revision = null, string $fromVault = null, SynchronizationProgressListenerInterface $progressListener = null): OperationResultList |
134 | 134 | { |
135 | - $this->getLogger()->notice(sprintf("Dumping from %s to {$targetPath}...", $revision ? "r{$revision}": 'latest revision')); |
|
135 | + $this->getLogger()->notice(sprintf("Dumping from %s to {$targetPath}...", $revision ? "r{$revision}" : 'latest revision')); |
|
136 | 136 | |
137 | 137 | $vault = $this->getVaultForDownload($revision, $fromVault); |
138 | 138 |
@@ -166,8 +166,7 @@ discard block |
||
166 | 166 | $this->getLogger()->debug("Vault {$vault->getIdentifier()} is at r{$lastSynchronization->getRevision()}"); |
167 | 167 | |
168 | 168 | $max = max($max, $lastSynchronization->getRevision()); |
169 | - } |
|
170 | - else |
|
169 | + } else |
|
171 | 170 | { |
172 | 171 | $this->getLogger()->debug("Vault {$vault->getIdentifier()} has no synchronizations yet"); |
173 | 172 | } |
@@ -226,8 +225,7 @@ discard block |
||
226 | 225 | if ($vaultTitle) |
227 | 226 | { |
228 | 227 | $vault = $vaultContainer->getVaultByTitle($vaultTitle); |
229 | - } |
|
230 | - else |
|
228 | + } else |
|
231 | 229 | { |
232 | 230 | $vaults = $vaultContainer->getVaultsHavingRevision($revision); |
233 | 231 | $vault = $vaultContainer->getPrioritizedVault($vaults); |
@@ -41,8 +41,7 @@ |
||
41 | 41 | if ($parentNode === null) |
42 | 42 | { |
43 | 43 | throw new Exception("Trying to add object {$indexObject->getRelativePath()} without existing parent node"); |
44 | - } |
|
45 | - elseif (!$parentNode->getIndexObject()->isDirectory()) |
|
44 | + } elseif (!$parentNode->getIndexObject()->isDirectory()) |
|
46 | 45 | { |
47 | 46 | throw new Exception("Trying to add object {$indexObject->getRelativePath()} under parent node which is not a directory"); |
48 | 47 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class Application extends \Symfony\Component\Console\Application |
6 | 6 | { |
7 | - public const LOGO = <<<TXT |
|
7 | + public const LOGO = <<<TXT |
|
8 | 8 | ____ _ |
9 | 9 | / ___|| |_ ___ _ __ ___ _ __ ___ __ _ _ __ |
10 | 10 | \___ \| __/ _ \| '__/ _ \ '_ ` _ \ / _` | '_ \ |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | throw new Exception(sprintf('writeStream() failed for %s.', $relativePath)); |
48 | 48 | } |
49 | - } |
|
50 | - catch (\Exception $exception) |
|
49 | + } catch (\Exception $exception) |
|
51 | 50 | { |
52 | 51 | throw new Exception($exception->getMessage(), 0, $exception); |
53 | 52 | } |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | try |
59 | 58 | { |
60 | 59 | return $this->filesystem->has($relativePath); |
61 | - } |
|
62 | - catch (\Exception $exception) |
|
60 | + } catch (\Exception $exception) |
|
63 | 61 | { |
64 | 62 | throw new Exception($exception->getMessage(), 0, $exception); |
65 | 63 | } |
@@ -77,8 +75,7 @@ discard block |
||
77 | 75 | { |
78 | 76 | throw new Exception(sprintf('unlink() failed for %s', $relativePath)); |
79 | 77 | } |
80 | - } |
|
81 | - catch (\Exception $exception) |
|
78 | + } catch (\Exception $exception) |
|
82 | 79 | { |
83 | 80 | throw new Exception($exception->getMessage(), 0, $exception); |
84 | 81 | } |
@@ -98,8 +95,7 @@ discard block |
||
98 | 95 | } |
99 | 96 | |
100 | 97 | return $stream; |
101 | - } |
|
102 | - catch (\Exception $exception) |
|
98 | + } catch (\Exception $exception) |
|
103 | 99 | { |
104 | 100 | throw new Exception($exception->getMessage(), 0, $exception); |
105 | 101 | } |
@@ -96,8 +96,7 @@ |
||
96 | 96 | |
97 | 97 | unset($this->lockDepthMap[$name]); |
98 | 98 | } |
99 | - } |
|
100 | - else |
|
99 | + } else |
|
101 | 100 | { |
102 | 101 | $this->logger->info("Requested lock release for non-hold lock '{$name}'. Doing nothing."); |
103 | 102 | } |
@@ -17,12 +17,10 @@ |
||
17 | 17 | if (!file_exists($path)) |
18 | 18 | { |
19 | 19 | throw new \InvalidArgumentException("Given path '{$path}' does not exist."); |
20 | - } |
|
21 | - elseif (!is_dir($path)) |
|
20 | + } elseif (!is_dir($path)) |
|
22 | 21 | { |
23 | 22 | throw new \InvalidArgumentException("Given path '{$path}' is not a directory."); |
24 | - } |
|
25 | - elseif (!is_readable($path)) |
|
23 | + } elseif (!is_readable($path)) |
|
26 | 24 | { |
27 | 25 | throw new \InvalidArgumentException("Given directory '{$path}' is not readable.'"); |
28 | 26 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $contexts[$algorithm] = hash_init($algorithm); |
14 | 14 | } |
15 | 15 | |
16 | -while(!feof($fileHandle)) |
|
16 | +while (!feof($fileHandle)) |
|
17 | 17 | { |
18 | 18 | $buffer = fread($fileHandle, 65536); |
19 | 19 |
@@ -17,7 +17,6 @@ |
||
17 | 17 | * |
18 | 18 | * @param Index $mergedIndex |
19 | 19 | * @param Index $localIndex |
20 | - * @param Index|null $remoteIndex |
|
21 | 20 | * @return OperationList |
22 | 21 | */ |
23 | 22 | public function buildOperationList(Index $mergedIndex, Index $localIndex): OperationList; |
@@ -100,6 +100,10 @@ discard block |
||
100 | 100 | return $mergedIndex; |
101 | 101 | } |
102 | 102 | |
103 | + /** |
|
104 | + * @param IndexObject|null $localObject |
|
105 | + * @param IndexObject|null $lastLocalObject |
|
106 | + */ |
|
103 | 107 | protected function isLocalObjectModified(?IndexObject $localObject, ?IndexObject $lastLocalObject, int $options): bool |
104 | 108 | { |
105 | 109 | if (!$lastLocalObject) |
@@ -132,6 +136,10 @@ discard block |
||
132 | 136 | return $localObjectModified; |
133 | 137 | } |
134 | 138 | |
139 | + /** |
|
140 | + * @param IndexObject|null $remoteObject |
|
141 | + * @param IndexObject|null $lastLocalObject |
|
142 | + */ |
|
135 | 143 | protected function isRemoteObjectModified(?IndexObject $remoteObject, ?IndexObject $lastLocalObject): bool |
136 | 144 | { |
137 | 145 | if ($lastLocalObject) |
@@ -144,6 +152,10 @@ discard block |
||
144 | 152 | } |
145 | 153 | } |
146 | 154 | |
155 | + /** |
|
156 | + * @param IndexObject|null $localObject |
|
157 | + * @param IndexObject|null $lastLocalObject |
|
158 | + */ |
|
147 | 159 | protected function resolveConflict(ConflictHandlerInterface $conflictHandler, IndexObject $remoteObject, ?IndexObject $localObject, ?IndexObject $lastLocalObject): IndexObject |
148 | 160 | { |
149 | 161 | $this->logger->notice("Resolving conflict at {$remoteObject->getRelativePath()}..."); |
@@ -75,12 +75,10 @@ discard block |
||
75 | 75 | if ($localObjectModified && $remoteObjectModified) |
76 | 76 | { |
77 | 77 | $mergedIndex->addObject($this->resolveConflict($conflictHandler, $remoteObject, $localObject, $lastLocalObject)); |
78 | - } |
|
79 | - elseif ($localObjectModified && $localObject !== null) |
|
78 | + } elseif ($localObjectModified && $localObject !== null) |
|
80 | 79 | { |
81 | 80 | $mergedIndex->addObject($localObject); |
82 | - } |
|
83 | - elseif ($remoteObjectModified && $remoteObject !== null) |
|
81 | + } elseif ($remoteObjectModified && $remoteObject !== null) |
|
84 | 82 | { |
85 | 83 | $mergedIndex->addObject($remoteObject); |
86 | 84 | } |
@@ -137,8 +135,7 @@ discard block |
||
137 | 135 | if ($lastLocalObject) |
138 | 136 | { |
139 | 137 | return !$lastLocalObject->equals($remoteObject, IndexObject::CMP_IGNORE_BLOBID | IndexObject::CMP_IGNORE_INODE); |
140 | - } |
|
141 | - else |
|
138 | + } else |
|
142 | 139 | { |
143 | 140 | return $remoteObject !== null; |
144 | 141 | } |