Completed
Push — feature/EVO-10498-optional-bas... ( fb0241...dd6110 )
by
unknown
02:20
created
src/Command/ImportCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $output->writeln("<info>Loading data from ${file}</info>");
214 214
 
215 215
             if (!array_key_exists('target', $doc->getData())) {
216
-                throw new MissingTargetException('Missing target in \'' . $file . '\'');
216
+                throw new MissingTargetException('Missing target in \''.$file.'\'');
217 217
             }
218 218
 
219 219
             $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']);
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
         $content = str_replace($rewriteHost, $rewriteTo, $doc->getContent());
260 260
         $uploadFile = $this->validateUploadFile($doc, $file);
261 261
 
262
-        $successFunc = function (ResponseInterface $response) use ($output) {
262
+        $successFunc = function(ResponseInterface $response) use ($output) {
263 263
             $output->writeln(
264
-                '<comment>Wrote ' . $response->getHeader('Link')[0] . '</comment>'
264
+                '<comment>Wrote '.$response->getHeader('Link')[0].'</comment>'
265 265
             );
266 266
         };
267 267
 
268
-        $errFunc = function (RequestException $e) use ($output, $file) {
268
+        $errFunc = function(RequestException $e) use ($output, $file) {
269 269
             $this->errors[$file] = $e->getMessage();
270 270
             $output->writeln(
271
-                '<error>' . str_pad(
271
+                '<error>'.str_pad(
272 272
                     sprintf(
273 273
                         'Failed to write <%s> from \'%s\' with message \'%s\'',
274 274
                         $e->getRequest()->getUri(),
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
                     ),
278 278
                     140,
279 279
                     ' '
280
-                ) . '</error>'
280
+                ).'</error>'
281 281
             );
282 282
             if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
283 283
                 $this->dumper->dump(
284 284
                     $this->cloner->cloneVar(
285 285
                         $this->parser->parse($e->getResponse()->getBody(), false, false, true)
286 286
                     ),
287
-                    function ($line, $depth) use ($output) {
287
+                    function($line, $depth) use ($output) {
288 288
                         if ($depth > 0) {
289 289
                             $output->writeln(
290
-                                '<error>' . str_pad(str_repeat('  ', $depth) . $line, 140, ' ') . '</error>'
290
+                                '<error>'.str_pad(str_repeat('  ', $depth).$line, 140, ' ').'</error>'
291 291
                             );
292 292
                         }
293 293
                     }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             'upload' => $uploadFile
301 301
         ];
302 302
         if ($this->headerBasicAuth) {
303
-            $data['headers'] = ['Authorization' => 'Basic '. base64_encode($this->headerBasicAuth)];
303
+            $data['headers'] = ['Authorization' => 'Basic '.base64_encode($this->headerBasicAuth)];
304 304
         }
305 305
         $promise = $this->client->requestAsync(
306 306
             'PUT',
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
         // TODO This part, $uploadFile, promise should be removed once Graviton/File service is resolved in new Story.
313 313
         $fileRepeatFunc = false;
314 314
         if ($uploadFile) {
315
-            $fileRepeatFunc = function () use ($targetUrl, $successFunc, $errFunc, $output, $file, $data) {
315
+            $fileRepeatFunc = function() use ($targetUrl, $successFunc, $errFunc, $output, $file, $data) {
316 316
                 unset($this->errors[$file]);
317 317
                 $output->writeln('<info>File deleting: '.$targetUrl.'</info>');
318 318
                 $deleteRequest = $this->client->requestAsync('DELETE', $targetUrl);
319
-                $insert = function () use ($targetUrl, $successFunc, $errFunc, $output, $data) {
319
+                $insert = function() use ($targetUrl, $successFunc, $errFunc, $output, $data) {
320 320
                     $output->writeln('<info>File inserting: '.$targetUrl.'</info>');
321 321
                     $promiseInsert = $this->client->requestAsync('PUT', $targetUrl, $data);
322 322
                     $promiseInsert->then($successFunc, $errFunc);
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         }
387 387
 
388 388
         // Find file
389
-        $fileName = dirname($originFile) . DIRECTORY_SEPARATOR . $documentData['file'];
389
+        $fileName = dirname($originFile).DIRECTORY_SEPARATOR.$documentData['file'];
390 390
         $fileName = str_replace('//', '/', $fileName);
391 391
         if (!file_exists($fileName)) {
392 392
             return false;
Please login to merge, or discard this patch.