@@ -116,9 +116,9 @@ |
||
| 116 | 116 | try { |
| 117 | 117 | /** @var \ObjectStorage_Container $container */ |
| 118 | 118 | $container = $objectStorage->with($this->container . $targetPath) |
| 119 | - ->setLocalFile($sourcePath) |
|
| 120 | - ->setMeta('description', 'PHPBU Backup: ' . date('r', time())) |
|
| 121 | - ->setHeader('Content-Type', $target->getMimeType()); |
|
| 119 | + ->setLocalFile($sourcePath) |
|
| 120 | + ->setMeta('description', 'PHPBU Backup: ' . date('r', time())) |
|
| 121 | + ->setHeader('Content-Type', $target->getMimeType()); |
|
| 122 | 122 | $container->create(); |
| 123 | 123 | } catch (\Exception $e) { |
| 124 | 124 | throw new Exception($e->getMessage(), null, $e); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // check for mandatory options |
| 74 | 74 | foreach (['user', 'secret', 'container', 'host', 'path'] as $option) { |
| 75 | 75 | if (!Arr::isSetAndNotEmptyString($config, $option)) { |
| 76 | - throw new Exception('SoftLayer ' . $option . ' is mandatory'); |
|
| 76 | + throw new Exception('SoftLayer '.$option.' is mandatory'); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -97,19 +97,19 @@ discard block |
||
| 97 | 97 | public function sync(Target $target, Result $result) |
| 98 | 98 | { |
| 99 | 99 | $sourcePath = $target->getPathname(); |
| 100 | - $targetPath = $this->path . $target->getFilename(); |
|
| 100 | + $targetPath = $this->path.$target->getFilename(); |
|
| 101 | 101 | |
| 102 | 102 | $options = ['adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 20]; |
| 103 | 103 | $objectStorage = new ObjectStorage($this->host, $this->user, $this->secret, $options); |
| 104 | 104 | |
| 105 | - $result->debug('softlayer source: ' . $sourcePath); |
|
| 106 | - $result->debug('softlayer target: ' . $targetPath); |
|
| 105 | + $result->debug('softlayer source: '.$sourcePath); |
|
| 106 | + $result->debug('softlayer target: '.$targetPath); |
|
| 107 | 107 | |
| 108 | 108 | try { |
| 109 | 109 | /** @var \ObjectStorage_Container $container */ |
| 110 | - $container = $objectStorage->with($this->container . $targetPath) |
|
| 110 | + $container = $objectStorage->with($this->container.$targetPath) |
|
| 111 | 111 | ->setLocalFile($sourcePath) |
| 112 | - ->setMeta('description', 'PHPBU Backup: ' . date('r', time())) |
|
| 112 | + ->setMeta('description', 'PHPBU Backup: '.date('r', time())) |
|
| 113 | 113 | ->setHeader('Content-Type', $target->getMimeType()); |
| 114 | 114 | $container->create(); |
| 115 | 115 | } catch (\Exception $e) { |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | public function simulate(Target $target, Result $result) |
| 129 | 129 | { |
| 130 | 130 | $result->debug( |
| 131 | - 'sync backup to SoftLayer' . PHP_EOL |
|
| 132 | - . ' host: ' . $this->host . PHP_EOL |
|
| 133 | - . ' user: ' . $this->user . PHP_EOL |
|
| 134 | - . ' secret: ********' . PHP_EOL |
|
| 135 | - . ' container: ' . $this->container . PHP_EOL |
|
| 136 | - . ' location: ' . $this->path |
|
| 131 | + 'sync backup to SoftLayer'.PHP_EOL |
|
| 132 | + . ' host: '.$this->host.PHP_EOL |
|
| 133 | + . ' user: '.$this->user.PHP_EOL |
|
| 134 | + . ' secret: ********'.PHP_EOL |
|
| 135 | + . ' container: '.$this->container.PHP_EOL |
|
| 136 | + . ' location: '.$this->path |
|
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -5,8 +5,6 @@ |
||
| 5 | 5 | use phpbu\App\Result; |
| 6 | 6 | use phpbu\App\Backup\Sync; |
| 7 | 7 | use phpbu\App\Backup\Target; |
| 8 | -use phpbu\App\Util\Arr; |
|
| 9 | -use phpbu\App\Util\Str; |
|
| 10 | 8 | |
| 11 | 9 | /** |
| 12 | 10 | * Amazon S3 Sync |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public function sync(Target $target, Result $result) |
| 33 | 33 | { |
| 34 | 34 | $sourcePath = $target->getPathname(); |
| 35 | - $targetPath = $this->path . $target->getFilename(); |
|
| 35 | + $targetPath = $this->path.$target->getFilename(); |
|
| 36 | 36 | |
| 37 | 37 | $s3 = S3Client::factory( |
| 38 | 38 | [ |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public static function withTrailingSlash($string) |
| 187 | 187 | { |
| 188 | - return $string . (substr($string, -1) !== '/' ? '/' : ''); |
|
| 188 | + return $string.(substr($string, -1) !== '/' ? '/' : ''); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public static function withLeadingSlash($string) |
| 209 | 209 | { |
| 210 | - return (substr($string, 0, 1) !== '/' ? '/' : '') . $string; |
|
| 210 | + return (substr($string, 0, 1) !== '/' ? '/' : '').$string; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -230,6 +230,6 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public static function appendPluralS($subject, $amount) |
| 232 | 232 | { |
| 233 | - return $subject . ($amount == 1 ? '' : (substr($subject, -1) == 's' ? '\'s' : 's')); |
|
| 233 | + return $subject.($amount == 1 ? '' : (substr($subject, -1) == 's' ? '\'s' : 's')); |
|
| 234 | 234 | } |
| 235 | 235 | } |
@@ -101,11 +101,11 @@ |
||
| 101 | 101 | public function simulate(Target $target, Result $result) |
| 102 | 102 | { |
| 103 | 103 | $result->debug( |
| 104 | - 'sync backup to ' . $this->getProtocolName() . ' server' . PHP_EOL |
|
| 105 | - . ' host: ' . $this->host . PHP_EOL |
|
| 106 | - . ' user: ' . $this->user . PHP_EOL |
|
| 107 | - . ' password: ********' . PHP_EOL |
|
| 108 | - . ' path: ' . $this->remotePath |
|
| 104 | + 'sync backup to '.$this->getProtocolName().' server'.PHP_EOL |
|
| 105 | + . ' host: '.$this->host.PHP_EOL |
|
| 106 | + . ' user: '.$this->user.PHP_EOL |
|
| 107 | + . ' password: ********'.PHP_EOL |
|
| 108 | + . ' path: '.$this->remotePath |
|
| 109 | 109 | ); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // make sure there is a scheme |
| 182 | 182 | if (!isset($parsed['scheme'])) { |
| 183 | - $parsed = parse_url('http://' . $host); |
|
| 183 | + $parsed = parse_url('http://'.$host); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $url = $parsed['scheme'] . '://' . $this->getAuthUrlSnippet($user, $password) . $parsed['host']; |
|
| 186 | + $url = $parsed['scheme'].'://'.$this->getAuthUrlSnippet($user, $password).$parsed['host']; |
|
| 187 | 187 | |
| 188 | 188 | if (isset($parsed['port'])) { |
| 189 | - $url .= ':' . $parsed['port']; |
|
| 189 | + $url .= ':'.$parsed['port']; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (!empty($parsed['path'])) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $url = $user; |
| 215 | 215 | |
| 216 | 216 | if (!empty($password)) { |
| 217 | - $url .= ':' . $password; |
|
| 217 | + $url .= ':'.$password; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (!empty($url)) { |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $loaded = $document->loadXML($contents); |
| 382 | 382 | |
| 383 | 383 | foreach (libxml_get_errors() as $error) { |
| 384 | - $message .= "\n" . $error->message; |
|
| 384 | + $message .= "\n".$error->message; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | libxml_use_internal_errors($internal); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | sprintf( |
| 393 | 393 | 'Error loading file "%s".%s', |
| 394 | 394 | $filename, |
| 395 | - $message != '' ? "\n" . $message : '' |
|
| 395 | + $message != '' ? "\n".$message : '' |
|
| 396 | 396 | ) |
| 397 | 397 | ); |
| 398 | 398 | } |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | public function parseShortOption($arg, array &$options) |
| 102 | 102 | { |
| 103 | 103 | if (!isset($this->shortOptions[$arg])) { |
| 104 | - throw new Exception('unknown option: -' . $arg); |
|
| 104 | + throw new Exception('unknown option: -'.$arg); |
|
| 105 | 105 | } |
| 106 | - $options['-' . $arg] = true; |
|
| 106 | + $options['-'.$arg] = true; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -123,17 +123,17 @@ discard block |
||
| 123 | 123 | $argument = $list[1]; |
| 124 | 124 | } |
| 125 | 125 | if (count($list) > 2) { |
| 126 | - throw new Exception('invalid value for option: --' . $arg); |
|
| 126 | + throw new Exception('invalid value for option: --'.$arg); |
|
| 127 | 127 | } |
| 128 | - if (!isset($this->longOptions[$option]) && !isset($this->longOptions[$option . '='])) { |
|
| 129 | - throw new Exception('unknown option: --' . $option); |
|
| 128 | + if (!isset($this->longOptions[$option]) && !isset($this->longOptions[$option.'='])) { |
|
| 129 | + throw new Exception('unknown option: --'.$option); |
|
| 130 | 130 | } |
| 131 | - if ($argument === true && isset($this->longOptions[$option . '='])) { |
|
| 132 | - throw new Exception('argument required for option: --' . $option); |
|
| 131 | + if ($argument === true && isset($this->longOptions[$option.'='])) { |
|
| 132 | + throw new Exception('argument required for option: --'.$option); |
|
| 133 | 133 | } |
| 134 | 134 | if ($argument !== true && isset($this->longOptions[$option])) { |
| 135 | - throw new Exception('needless argument for option: --' . $option); |
|
| 135 | + throw new Exception('needless argument for option: --'.$option); |
|
| 136 | 136 | } |
| 137 | - $options['--' . $option] = $argument; |
|
| 137 | + $options['--'.$option] = $argument; |
|
| 138 | 138 | } |
| 139 | 139 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | $replacements = array(); |
| 7 | 7 | |
| 8 | 8 | foreach ($patches as $file) { |
| 9 | - echo 'patching file: ' . $file['path'] . "..."; |
|
| 9 | + echo 'patching file: '.$file['path']."..."; |
|
| 10 | 10 | file_put_contents( |
| 11 | 11 | $file['path'], |
| 12 | 12 | str_replace( |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | file_get_contents($file['path']) |
| 16 | 16 | ) |
| 17 | 17 | ); |
| 18 | - echo ' done' . PHP_EOL; |
|
| 18 | + echo ' done'.PHP_EOL; |
|
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | foreach ($replacements as $file) { |
| 22 | - echo 'replacing file: ' . $file['path'] . "..."; |
|
| 22 | + echo 'replacing file: '.$file['path']."..."; |
|
| 23 | 23 | file_put_contents($file['path'], $file['content']); |
| 24 | - echo ' done' . PHP_EOL; |
|
| 24 | + echo ' done'.PHP_EOL; |
|
| 25 | 25 | } |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | file_put_contents( |
| 14 | - __DIR__ . '/phar/Version.php', |
|
| 14 | + __DIR__.'/phar/Version.php', |
|
| 15 | 15 | str_replace( |
| 16 | 16 | 'private static $pharVersion;', |
| 17 | - 'private static $pharVersion = "' . $version . '";', |
|
| 18 | - file_get_contents(__DIR__ . '/phar/Version.php') |
|
| 17 | + 'private static $pharVersion = "'.$version.'";', |
|
| 18 | + file_get_contents(__DIR__.'/phar/Version.php') |
|
| 19 | 19 | ) |
| 20 | 20 | ); |
| 21 | 21 | |