@@ -29,8 +29,7 @@ |
||
29 | 29 | fclose($localStream); |
30 | 30 | |
31 | 31 | return true; |
32 | - } |
|
33 | - catch (Exception $exception) |
|
32 | + } catch (Exception $exception) |
|
34 | 33 | { |
35 | 34 | return false; |
36 | 35 | } |
@@ -38,8 +38,7 @@ |
||
38 | 38 | if ($parent === null) |
39 | 39 | { |
40 | 40 | throw new Exception(); |
41 | - } |
|
42 | - elseif (!$parent->isDirectory()) |
|
41 | + } elseif (!$parent->isDirectory()) |
|
43 | 42 | { |
44 | 43 | throw new Exception(); |
45 | 44 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class Application extends \Symfony\Component\Console\Application |
6 | 6 | { |
7 | - const LOGO = <<<TXT |
|
7 | + const LOGO = <<<TXT |
|
8 | 8 | ___ __ _ ___ |
9 | 9 | / _ | ________/ / (_) __/ _ \ |
10 | 10 | / __ |/ __/ __/ _ \/ / |/ / , _/ |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $archivr = new ArchivR($configuration); |
28 | 28 | $archivr->dump( |
29 | 29 | $input->getArgument('path'), |
30 | - $input->getOption( 'revision') ? (int)$input->getOption('revision') : null, |
|
30 | + $input->getOption('revision') ? (int)$input->getOption('revision') : null, |
|
31 | 31 | $input->getOption('vault'), |
32 | 32 | new SynchronizationProgressListener($output) |
33 | 33 | ); |
@@ -173,17 +173,14 @@ |
||
173 | 173 | { |
174 | 174 | $object->type = static::TYPE_FILE; |
175 | 175 | $object->size = (int)$stat['size']; |
176 | - } |
|
177 | - elseif (is_dir($absolutePath)) |
|
176 | + } elseif (is_dir($absolutePath)) |
|
178 | 177 | { |
179 | 178 | $object->type = static::TYPE_DIR; |
180 | - } |
|
181 | - elseif (is_link($absolutePath)) |
|
179 | + } elseif (is_link($absolutePath)) |
|
182 | 180 | { |
183 | 181 | $object->type = static::TYPE_LINK; |
184 | 182 | $object->linkTarget = str_replace($basePath, '', readlink($absolutePath)); |
185 | - } |
|
186 | - else |
|
183 | + } else |
|
187 | 184 | { |
188 | 185 | throw new \LogicException(); |
189 | 186 | } |
@@ -589,6 +589,9 @@ discard block |
||
589 | 589 | return $operationResultList; |
590 | 590 | } |
591 | 591 | |
592 | + /** |
|
593 | + * @param resource $stream |
|
594 | + */ |
|
592 | 595 | protected function readIndexFromStream($stream): Index |
593 | 596 | { |
594 | 597 | if (!is_resource($stream)) |
@@ -623,6 +626,9 @@ discard block |
||
623 | 626 | fclose($stream); |
624 | 627 | } |
625 | 628 | |
629 | + /** |
|
630 | + * @param resource $stream |
|
631 | + */ |
|
626 | 632 | protected function readSynchronizationListFromStream($stream): SynchronizationList |
627 | 633 | { |
628 | 634 | if (!is_resource($stream)) |
@@ -292,8 +292,7 @@ |
||
292 | 292 | { |
293 | 293 | $newRevision = $newRevision ?: ($lastSynchronization->getRevision() + 1); |
294 | 294 | $remoteIndex = $this->doLoadRemoteIndex($lastSynchronization->getRevision(), $synchronizationList); |
295 | - } |
|
296 | - else |
|
295 | + } else |
|
297 | 296 | { |
298 | 297 | $newRevision = $newRevision ?: 1; |
299 | 298 | $remoteIndex = null; |
@@ -89,9 +89,7 @@ |
||
89 | 89 | // compare remote object to object state at last sync |
90 | 90 | // we explicitly want to use equality instead of identity |
91 | 91 | $remoteObjectModified = !($remoteObject == $lastLocalObject); |
92 | - } |
|
93 | - |
|
94 | - else |
|
92 | + } else |
|
95 | 93 | { |
96 | 94 | // object already didn't exist locally at the last sync |
97 | 95 | $localObjectModified = false; |
@@ -68,9 +68,7 @@ discard block |
||
68 | 68 | $directoryMtimes[$mergedIndexObject->getRelativePath()] = $mergedIndexObject->getMtime(); |
69 | 69 | } |
70 | 70 | } |
71 | - } |
|
72 | - |
|
73 | - elseif ($mergedIndexObject->isFile()) |
|
71 | + } elseif ($mergedIndexObject->isFile()) |
|
74 | 72 | { |
75 | 73 | // local file did not exist, hasn't been a file before or is outdated |
76 | 74 | $doDownloadFile = $localObject === null || !$localObject->isFile() || $localObject->getMtime() < $mergedIndexObject->getMtime(); |
@@ -98,9 +96,7 @@ discard block |
||
98 | 96 | |
99 | 97 | $operationList->addOperation(new UploadOperation($mergedIndexObject->getRelativePath(), $mergedIndexObject->getBlobId(), $uploadStreamFilters)); |
100 | 98 | } |
101 | - } |
|
102 | - |
|
103 | - elseif ($mergedIndexObject->isLink()) |
|
99 | + } elseif ($mergedIndexObject->isLink()) |
|
104 | 100 | { |
105 | 101 | if ($localObject !== null && $localObject->getLinkTarget() !== $mergedIndexObject->getLinkTarget()) |
106 | 102 | { |
@@ -109,9 +105,7 @@ discard block |
||
109 | 105 | |
110 | 106 | $modifiedPaths[] = $mergedIndexObject->getRelativePath(); |
111 | 107 | } |
112 | - } |
|
113 | - |
|
114 | - else |
|
108 | + } else |
|
115 | 109 | { |
116 | 110 | // unknown/invalid object type |
117 | 111 | throw new Exception(); |
@@ -107,8 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | $table->render(); |
110 | - } |
|
111 | - else |
|
110 | + } else |
|
112 | 111 | { |
113 | 112 | $output->writeln('No synchronizations so far.'); |
114 | 113 | } |
@@ -124,8 +123,7 @@ discard block |
||
124 | 123 | if ($count = count($operationList)) |
125 | 124 | { |
126 | 125 | $output->writeln(sprintf('<bold>There are %d outstanding operations.</bold>', $count)); |
127 | - } |
|
128 | - else |
|
126 | + } else |
|
129 | 127 | { |
130 | 128 | $output->writeln('<info>Everything is up to date!</info>'); |
131 | 129 | } |