@@ -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()}..."); |
@@ -76,12 +76,10 @@ discard block |
||
76 | 76 | if ($localObjectModified && $remoteObjectModified) |
77 | 77 | { |
78 | 78 | $mergedIndex->addObject($this->resolveConflict($conflictHandler, $remoteObject, $localObject, $lastLocalObject)); |
79 | - } |
|
80 | - elseif ($localObjectModified && $localObject !== null) |
|
79 | + } elseif ($localObjectModified && $localObject !== null) |
|
81 | 80 | { |
82 | 81 | $mergedIndex->addObject($localObject); |
83 | - } |
|
84 | - elseif ($remoteObjectModified && $remoteObject !== null) |
|
82 | + } elseif ($remoteObjectModified && $remoteObject !== null) |
|
85 | 83 | { |
86 | 84 | $mergedIndex->addObject($remoteObject); |
87 | 85 | } |
@@ -146,8 +144,7 @@ discard block |
||
146 | 144 | if ($lastLocalObject) |
147 | 145 | { |
148 | 146 | return !$lastLocalObject->equals($remoteObject, static::CMP_OPTIONS); |
149 | - } |
|
150 | - else |
|
147 | + } else |
|
151 | 148 | { |
152 | 149 | return $remoteObject !== null; |
153 | 150 | } |
@@ -35,12 +35,10 @@ |
||
35 | 35 | if ($indexObjectA instanceof IndexObject) |
36 | 36 | { |
37 | 37 | $this->relativePath = $indexObjectA->getRelativePath(); |
38 | - } |
|
39 | - elseif ($indexObjectB instanceof IndexObject) |
|
38 | + } elseif ($indexObjectB instanceof IndexObject) |
|
40 | 39 | { |
41 | 40 | $this->relativePath = $indexObjectB->getRelativePath(); |
42 | - } |
|
43 | - else |
|
41 | + } else |
|
44 | 42 | { |
45 | 43 | throw new \LogicException(); |
46 | 44 | } |