@@ -275,6 +275,10 @@ |
||
275 | 275 | return $remoteObject->getBlobId() !== $lastLocalObject->getBlobId(); |
276 | 276 | } |
277 | 277 | |
278 | + /** |
|
279 | + * @param IndexObject $localObject |
|
280 | + * @param IndexObject $lastLocalObject |
|
281 | + */ |
|
278 | 282 | protected function resolveConflict(ConflictHandlerInterface $conflictHandler, IndexObject $remoteObject, ?IndexObject $localObject, ?IndexObject $lastLocalObject): IndexObject |
279 | 283 | { |
280 | 284 | $this->logger->notice("Resolving conflict at {$remoteObject->getRelativePath()}..."); |
@@ -100,38 +100,32 @@ discard block |
||
100 | 100 | { |
101 | 101 | // locally and remotely deleted |
102 | 102 | return null; |
103 | - } |
|
104 | - elseif ($lastLocalObject === null) |
|
103 | + } elseif ($lastLocalObject === null) |
|
105 | 104 | { |
106 | 105 | if ($remoteObject === null) |
107 | 106 | { |
108 | 107 | // locally created |
109 | 108 | return clone $localObject; |
110 | - } |
|
111 | - elseif ($localObject === null) |
|
109 | + } elseif ($localObject === null) |
|
112 | 110 | { |
113 | 111 | // remotely created |
114 | 112 | return clone $remoteObject; |
115 | - } |
|
116 | - elseif ($remoteObject !== null && $localObject !== null) |
|
113 | + } elseif ($remoteObject !== null && $localObject !== null) |
|
117 | 114 | { |
118 | 115 | // remotely and locally created |
119 | 116 | return $this->resolveConflict($conflictHandler, $remoteObject, $localObject, $lastLocalObject); |
120 | 117 | } |
121 | - } |
|
122 | - elseif ($remoteObject === null) |
|
118 | + } elseif ($remoteObject === null) |
|
123 | 119 | { |
124 | 120 | // remotely deleted and locally changed |
125 | 121 | return $this->resolveConflict($conflictHandler, $remoteObject, $localObject, $lastLocalObject); |
126 | - } |
|
127 | - elseif ($localObject === null) |
|
122 | + } elseif ($localObject === null) |
|
128 | 123 | { |
129 | 124 | if ($remoteObject->equals($lastLocalObject)) |
130 | 125 | { |
131 | 126 | // locally deleted |
132 | 127 | return null; |
133 | - } |
|
134 | - else |
|
128 | + } else |
|
135 | 129 | { |
136 | 130 | // remotely changed and locally deleted |
137 | 131 | return $this->resolveConflict($conflictHandler, $remoteObject, $localObject, $lastLocalObject); |
@@ -183,8 +177,7 @@ discard block |
||
183 | 177 | if ($modifiedRemote || !$modifiedLocal) |
184 | 178 | { |
185 | 179 | $attributes[$attribute] = $remoteObject[$attribute]; |
186 | - } |
|
187 | - else |
|
180 | + } else |
|
188 | 181 | { |
189 | 182 | $attributes[$attribute] = $localObject[$attribute]; |
190 | 183 | } |
@@ -210,8 +203,7 @@ discard block |
||
210 | 203 | $attributes['size'] = $remoteObject->getSize(); |
211 | 204 | $attributes['blobId'] = $remoteObject->getBlobId(); |
212 | 205 | $attributes['hashes'] = clone $remoteObject->getHashes(); |
213 | - } |
|
214 | - else |
|
206 | + } else |
|
215 | 207 | { |
216 | 208 | $attributes['size'] = $localObject->getSize(); |
217 | 209 | $attributes['inode'] = $localObject->getInode(); |
@@ -63,9 +63,7 @@ discard block |
||
63 | 63 | $toSetMtime[$mergedIndexObject->getRelativePath()] = $mergedIndexObject; |
64 | 64 | } |
65 | 65 | } |
66 | - } |
|
67 | - |
|
68 | - elseif ($mergedIndexObject->isFile()) |
|
66 | + } elseif ($mergedIndexObject->isFile()) |
|
69 | 67 | { |
70 | 68 | // local file did not exist, hasn't been a file before or has outdated content |
71 | 69 | $doDownloadFile = $localObject === null || !$localObject->isFile() || $mergedIndexObject->getBlobId() !== $localObject->getBlobId(); |
@@ -78,9 +76,7 @@ discard block |
||
78 | 76 | |
79 | 77 | $modifiedPaths[] = $mergedIndexObject->getRelativePath(); |
80 | 78 | } |
81 | - } |
|
82 | - |
|
83 | - elseif ($mergedIndexObject->isLink()) |
|
79 | + } elseif ($mergedIndexObject->isLink()) |
|
84 | 80 | { |
85 | 81 | if ($localObject !== null && $localObject->getLinkTarget() !== $mergedIndexObject->getLinkTarget()) |
86 | 82 | { |
@@ -89,9 +85,7 @@ discard block |
||
89 | 85 | |
90 | 86 | $modifiedPaths[] = $mergedIndexObject->getRelativePath(); |
91 | 87 | } |
92 | - } |
|
93 | - |
|
94 | - else |
|
88 | + } else |
|
95 | 89 | { |
96 | 90 | // unknown/invalid object type |
97 | 91 | throw new Exception(); |
@@ -284,8 +284,7 @@ |
||
284 | 284 | "size: {$this->size} B", |
285 | 285 | "blobId: {$blobId}", |
286 | 286 | ]); |
287 | - } |
|
288 | - elseif ($this->isLink()) |
|
287 | + } elseif ($this->isLink()) |
|
289 | 288 | { |
290 | 289 | $parts = array_merge($parts, [ |
291 | 290 | "target: {$this->linkTarget}", |