@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | throw new Exception(sprintf('read() failed for %s.', $relativePath)); |
| 31 | 31 | } |
| 32 | - } |
|
| 33 | - catch (FlysystemException $exception) |
|
| 32 | + } catch (FlysystemException $exception) |
|
| 34 | 33 | { |
| 35 | 34 | throw new Exception($exception->getMessage(), 0, $exception); |
| 36 | 35 | } |
@@ -48,8 +47,7 @@ discard block |
||
| 48 | 47 | { |
| 49 | 48 | throw new Exception(sprintf('write() failed for %s.', $relativePath)); |
| 50 | 49 | } |
| 51 | - } |
|
| 52 | - catch (FlysystemException $exception) |
|
| 50 | + } catch (FlysystemException $exception) |
|
| 53 | 51 | { |
| 54 | 52 | throw new Exception($exception->getMessage(), 0, $exception); |
| 55 | 53 | } |
@@ -65,8 +63,7 @@ discard block |
||
| 65 | 63 | { |
| 66 | 64 | throw new Exception(sprintf('writeStream() failed for %s.', $relativePath)); |
| 67 | 65 | } |
| 68 | - } |
|
| 69 | - catch (FlysystemException $exception) |
|
| 66 | + } catch (FlysystemException $exception) |
|
| 70 | 67 | { |
| 71 | 68 | throw new Exception($exception->getMessage(), 0, $exception); |
| 72 | 69 | } |
@@ -77,8 +74,7 @@ discard block |
||
| 77 | 74 | try |
| 78 | 75 | { |
| 79 | 76 | return $this->filesystem->has($relativePath); |
| 80 | - } |
|
| 81 | - catch (FlysystemException $exception) |
|
| 77 | + } catch (FlysystemException $exception) |
|
| 82 | 78 | { |
| 83 | 79 | throw new Exception($exception->getMessage(), 0, $exception); |
| 84 | 80 | } |
@@ -94,8 +90,7 @@ discard block |
||
| 94 | 90 | { |
| 95 | 91 | throw new Exception(sprintf('unlink() failed for %s', $relativePath)); |
| 96 | 92 | } |
| 97 | - } |
|
| 98 | - catch (FlysystemException $exception) |
|
| 93 | + } catch (FlysystemException $exception) |
|
| 99 | 94 | { |
| 100 | 95 | throw new Exception($exception->getMessage(), 0, $exception); |
| 101 | 96 | } |
@@ -113,8 +108,7 @@ discard block |
||
| 113 | 108 | } |
| 114 | 109 | |
| 115 | 110 | return $stream; |
| 116 | - } |
|
| 117 | - catch (FlysystemException $exception) |
|
| 111 | + } catch (FlysystemException $exception) |
|
| 118 | 112 | { |
| 119 | 113 | throw new Exception($exception->getMessage(), 0, $exception); |
| 120 | 114 | } |
@@ -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 | } |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | if ($input->getOption('config')) |
| 47 | 47 | { |
| 48 | 48 | $this->config = $reader->getConfiguration($input->getOption('config')); |
| 49 | - } |
|
| 50 | - elseif (is_file('archivr.json')) |
|
| 49 | + } elseif (is_file('archivr.json')) |
|
| 51 | 50 | { |
| 52 | 51 | $this->config = $reader->getConfiguration('archivr.json'); |
| 53 | 52 | } |
@@ -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 | / __ |/ __/ __/ _ \/ / |/ / , _/ |
@@ -427,7 +427,7 @@ |
||
| 427 | 427 | public function dump(string $targetPath, int $revision = null, SynchronizationProgressListenerInterface $progressListener = null): OperationResultCollection |
| 428 | 428 | { |
| 429 | 429 | $originalLocalPath = $this->localPath; |
| 430 | - $this->localPath = rtrim($this->expandTildePath($targetPath), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
| 430 | + $this->localPath = rtrim($this->expandTildePath($targetPath), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
| 431 | 431 | |
| 432 | 432 | try |
| 433 | 433 | { |
@@ -331,8 +331,7 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | $newRevision = $newRevision ?: ($lastSynchronization->getRevision() + 1); |
| 333 | 333 | $remoteIndex = $this->doLoadRemoteIndex($lastSynchronization->getRevision(), $synchronizationList); |
| 334 | - } |
|
| 335 | - else |
|
| 334 | + } else |
|
| 336 | 335 | { |
| 337 | 336 | $newRevision = $newRevision ?: 1; |
| 338 | 337 | $remoteIndex = null; |
@@ -474,12 +473,10 @@ discard block |
||
| 474 | 473 | try |
| 475 | 474 | { |
| 476 | 475 | return $this->doRestore($revision, $progressListener, true); |
| 477 | - } |
|
| 478 | - catch (\Exception $exception) |
|
| 476 | + } catch (\Exception $exception) |
|
| 479 | 477 | { |
| 480 | 478 | throw $exception; |
| 481 | - } |
|
| 482 | - finally |
|
| 479 | + } finally |
|
| 483 | 480 | { |
| 484 | 481 | $this->localPath = $originalLocalPath; |
| 485 | 482 | } |
@@ -593,6 +593,9 @@ discard block |
||
| 593 | 593 | return $operationResultCollection; |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | + /** |
|
| 597 | + * @param resource $stream |
|
| 598 | + */ |
|
| 596 | 599 | protected function readIndexFromStream($stream): Index |
| 597 | 600 | { |
| 598 | 601 | if (!is_resource($stream)) |
@@ -627,6 +630,9 @@ discard block |
||
| 627 | 630 | fclose($stream); |
| 628 | 631 | } |
| 629 | 632 | |
| 633 | + /** |
|
| 634 | + * @param resource $stream |
|
| 635 | + */ |
|
| 630 | 636 | protected function readSynchronizationListFromStream($stream): SynchronizationList |
| 631 | 637 | { |
| 632 | 638 | if (!is_resource($stream)) |
@@ -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 | ); |
@@ -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($operationCollection)) |
| 125 | 124 | { |
| 126 | 125 | $output->writeln(sprintf('<bold>There are %d outstanding operations.</bold>', count($operationCollection))); |
| 127 | - } |
|
| 128 | - else |
|
| 126 | + } else |
|
| 129 | 127 | { |
| 130 | 128 | $output->writeln('<info>Everything is up to date!</info>'); |
| 131 | 129 | } |
@@ -106,12 +106,10 @@ discard block |
||
| 106 | 106 | if (is_string($token)) |
| 107 | 107 | { |
| 108 | 108 | $output .= $token; |
| 109 | - } |
|
| 110 | - elseif (in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) |
|
| 109 | + } elseif (in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) |
|
| 111 | 110 | { |
| 112 | 111 | $output .= str_repeat("\n", substr_count($token[1], "\n")); |
| 113 | - } |
|
| 114 | - elseif (T_WHITESPACE === $token[0]) |
|
| 112 | + } elseif (T_WHITESPACE === $token[0]) |
|
| 115 | 113 | { |
| 116 | 114 | // reduce wide spaces |
| 117 | 115 | $whitespace = preg_replace('{[ \t]+}', ' ', $token[1]); |
@@ -123,8 +121,7 @@ discard block |
||
| 123 | 121 | $whitespace = preg_replace('{\n +}', "\n", $whitespace); |
| 124 | 122 | |
| 125 | 123 | $output .= $whitespace; |
| 126 | - } |
|
| 127 | - else |
|
| 124 | + } else |
|
| 128 | 125 | { |
| 129 | 126 | $output .= $token[1]; |
| 130 | 127 | } |