@@ -232,8 +232,7 @@ discard block |
||
| 232 | 232 | if ($localObject === null) |
| 233 | 233 | { |
| 234 | 234 | $operationCollection->addOperation(new MkdirOperation($absoluteLocalPath, $indexObject->getMode())); |
| 235 | - } |
|
| 236 | - elseif (!$localObject->isDirectory()) |
|
| 235 | + } elseif (!$localObject->isDirectory()) |
|
| 237 | 236 | { |
| 238 | 237 | $operationCollection->addOperation(new MkdirOperation($absoluteLocalPath, $indexObject->getMode())); |
| 239 | 238 | } |
@@ -245,9 +244,7 @@ discard block |
||
| 245 | 244 | $directoryMtimes[$absoluteLocalPath] = $indexObject->getMtime(); |
| 246 | 245 | } |
| 247 | 246 | } |
| 248 | - } |
|
| 249 | - |
|
| 250 | - elseif ($indexObject->isFile()) |
|
| 247 | + } elseif ($indexObject->isFile()) |
|
| 251 | 248 | { |
| 252 | 249 | // local file did not exist, hasn't been a file before or is outdated |
| 253 | 250 | if ($localObject === null || !$localObject->isFile() || $localObject->getMtime() < $indexObject->getMtime()) |
@@ -273,9 +270,7 @@ discard block |
||
| 273 | 270 | |
| 274 | 271 | $operationCollection->addOperation(new UploadOperation($absoluteLocalPath, $indexObject->getBlobId(), $this->vaultConnection)); |
| 275 | 272 | } |
| 276 | - } |
|
| 277 | - |
|
| 278 | - elseif ($indexObject->isLink()) |
|
| 273 | + } elseif ($indexObject->isLink()) |
|
| 279 | 274 | { |
| 280 | 275 | $absoluteLinkTarget = dirname($absoluteLocalPath) . DIRECTORY_SEPARATOR . $indexObject->getLinkTarget(); |
| 281 | 276 | |
@@ -284,9 +279,7 @@ discard block |
||
| 284 | 279 | $operationCollection->addOperation(new UnlinkOperation($absoluteLocalPath)); |
| 285 | 280 | $operationCollection->addOperation(new SymlinkOperation($absoluteLocalPath, $absoluteLinkTarget, $indexObject->getMode())); |
| 286 | 281 | } |
| 287 | - } |
|
| 288 | - |
|
| 289 | - else |
|
| 282 | + } else |
|
| 290 | 283 | { |
| 291 | 284 | // unknown object type |
| 292 | 285 | throw new \RuntimeException(); |
@@ -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 | } |
@@ -114,8 +114,7 @@ |
||
| 114 | 114 | try |
| 115 | 115 | { |
| 116 | 116 | @fclose($this->getStream($relativePath, 'r')); |
| 117 | - } |
|
| 118 | - catch(\RuntimeException $exception) |
|
| 117 | + } catch(\RuntimeException $exception) |
|
| 119 | 118 | { |
| 120 | 119 | return false; |
| 121 | 120 | } |
@@ -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 | } |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | { |
| 49 | 49 | $factory = new JsonFileConfigurationFactory($path); |
| 50 | 50 | return $factory(); |
| 51 | - } |
|
| 52 | - else |
|
| 51 | + } else |
|
| 53 | 52 | { |
| 54 | 53 | throw new \InvalidArgumentException(sprintf('Don\'t know how to handle configuration given file %s.', $path)); |
| 55 | 54 | } |
@@ -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 | } |
@@ -25,13 +25,11 @@ discard block |
||
| 25 | 25 | if ($localObjectModified) |
| 26 | 26 | { |
| 27 | 27 | $mergedIndex->addObject($localObject); |
| 28 | - } |
|
| 29 | - elseif ($remoteIndex === null) |
|
| 28 | + } elseif ($remoteIndex === null) |
|
| 30 | 29 | { |
| 31 | 30 | $mergedIndex->addObject($localObject); |
| 32 | 31 | } |
| 33 | - } |
|
| 34 | - else |
|
| 32 | + } else |
|
| 35 | 33 | { |
| 36 | 34 | // todo: merge mode by ctime |
| 37 | 35 | |
@@ -40,14 +38,10 @@ discard block |
||
| 40 | 38 | if (!$localObjectModified) |
| 41 | 39 | { |
| 42 | 40 | $mergedIndex->addObject($remoteObject); |
| 43 | - } |
|
| 44 | - |
|
| 45 | - elseif (!$remoteObjectModified) |
|
| 41 | + } elseif (!$remoteObjectModified) |
|
| 46 | 42 | { |
| 47 | 43 | $mergedIndex->addObject($localObject); |
| 48 | - } |
|
| 49 | - |
|
| 50 | - else |
|
| 44 | + } else |
|
| 51 | 45 | { |
| 52 | 46 | // todo: properly handle collision |
| 53 | 47 | throw new \RuntimeException("Collision at path {$localObject->getRelativePath()}"); |