@@ -161,17 +161,14 @@ |
||
| 161 | 161 | if (is_file($absolutePath)) |
| 162 | 162 | { |
| 163 | 163 | $object->type = static::TYPE_FILE; |
| 164 | - } |
|
| 165 | - elseif (is_dir($absolutePath)) |
|
| 164 | + } elseif (is_dir($absolutePath)) |
|
| 166 | 165 | { |
| 167 | 166 | $object->type = static::TYPE_DIR; |
| 168 | - } |
|
| 169 | - elseif (is_link($absolutePath)) |
|
| 167 | + } elseif (is_link($absolutePath)) |
|
| 170 | 168 | { |
| 171 | 169 | $object->type = static::TYPE_LINK; |
| 172 | 170 | $object->linkTarget = str_replace($basePath, '', readlink($absolutePath)); |
| 173 | - } |
|
| 174 | - else |
|
| 171 | + } else |
|
| 175 | 172 | { |
| 176 | 173 | throw new \InvalidArgumentException(sprintf('File %s does not exist!', $absolutePath)); |
| 177 | 174 | } |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | if (count($operationCollection)) |
| 27 | 27 | { |
| 28 | 28 | $output->writeln(sprintf('<info>There are %d outstanding operations!</info>', count($operationCollection))); |
| 29 | - } |
|
| 30 | - else |
|
| 29 | + } else |
|
| 31 | 30 | { |
| 32 | 31 | $output->writeln('<info>Everything is up to date!</info>'); |
| 33 | 32 | } |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | if ($parent === null) |
| 38 | 38 | { |
| 39 | 39 | throw new \InvalidArgumentException(); |
| 40 | - } |
|
| 41 | - elseif (!$parent->isDirectory()) |
|
| 40 | + } elseif (!$parent->isDirectory()) |
|
| 42 | 41 | { |
| 43 | 42 | throw new \InvalidArgumentException(); |
| 44 | 43 | } |
@@ -26,27 +26,21 @@ |
||
| 26 | 26 | if ($localObjectModified) |
| 27 | 27 | { |
| 28 | 28 | $mergedIndex->addObject($localObject); |
| 29 | - } |
|
| 30 | - elseif ($remoteIndex === null) |
|
| 29 | + } elseif ($remoteIndex === null) |
|
| 31 | 30 | { |
| 32 | 31 | $mergedIndex->addObject($localObject); |
| 33 | 32 | } |
| 34 | - } |
|
| 35 | - else |
|
| 33 | + } else |
|
| 36 | 34 | { |
| 37 | 35 | $remoteObjectModified = $lastLocalIndex ? ($remoteObject->getMtime() > $lastLocalIndex->getCreated()->getTimestamp()) : false; |
| 38 | 36 | |
| 39 | 37 | if (!$localObjectModified) |
| 40 | 38 | { |
| 41 | 39 | $mergedIndex->addObject($remoteObject); |
| 42 | - } |
|
| 43 | - |
|
| 44 | - elseif (!$remoteObjectModified) |
|
| 40 | + } elseif (!$remoteObjectModified) |
|
| 45 | 41 | { |
| 46 | 42 | $mergedIndex->addObject($localObject); |
| 47 | - } |
|
| 48 | - |
|
| 49 | - else |
|
| 43 | + } else |
|
| 50 | 44 | { |
| 51 | 45 | throw new Exception("Collision at path {$localObject->getRelativePath()}"); |
| 52 | 46 | } |
@@ -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 | } |
@@ -310,8 +310,7 @@ discard block |
||
| 310 | 310 | if ($localObject === null) |
| 311 | 311 | { |
| 312 | 312 | $operationCollection->addOperation(new MkdirOperation($absoluteLocalPath, $indexObject->getMode())); |
| 313 | - } |
|
| 314 | - elseif (!$localObject->isDirectory()) |
|
| 313 | + } elseif (!$localObject->isDirectory()) |
|
| 315 | 314 | { |
| 316 | 315 | $operationCollection->addOperation(new MkdirOperation($absoluteLocalPath, $indexObject->getMode())); |
| 317 | 316 | } |
@@ -323,9 +322,7 @@ discard block |
||
| 323 | 322 | $directoryMtimes[$absoluteLocalPath] = $indexObject->getMtime(); |
| 324 | 323 | } |
| 325 | 324 | } |
| 326 | - } |
|
| 327 | - |
|
| 328 | - elseif ($indexObject->isFile()) |
|
| 325 | + } elseif ($indexObject->isFile()) |
|
| 329 | 326 | { |
| 330 | 327 | // local file did not exist, hasn't been a file before or is outdated |
| 331 | 328 | if ($localObject === null || !$localObject->isFile() || $localObject->getMtime() < $indexObject->getMtime()) |
@@ -351,9 +348,7 @@ discard block |
||
| 351 | 348 | |
| 352 | 349 | $operationCollection->addOperation(new UploadOperation($absoluteLocalPath, $indexObject->getBlobId(), $this->vaultConnection)); |
| 353 | 350 | } |
| 354 | - } |
|
| 355 | - |
|
| 356 | - elseif ($indexObject->isLink()) |
|
| 351 | + } elseif ($indexObject->isLink()) |
|
| 357 | 352 | { |
| 358 | 353 | $absoluteLinkTarget = dirname($absoluteLocalPath) . DIRECTORY_SEPARATOR . $indexObject->getLinkTarget(); |
| 359 | 354 | |
@@ -362,9 +357,7 @@ discard block |
||
| 362 | 357 | $operationCollection->addOperation(new UnlinkOperation($absoluteLocalPath)); |
| 363 | 358 | $operationCollection->addOperation(new SymlinkOperation($absoluteLocalPath, $absoluteLinkTarget, $indexObject->getMode())); |
| 364 | 359 | } |
| 365 | - } |
|
| 366 | - |
|
| 367 | - else |
|
| 360 | + } else |
|
| 368 | 361 | { |
| 369 | 362 | // unknown object type |
| 370 | 363 | throw new Exception(); |
@@ -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 | } |