Completed
Pull Request — develop (#31)
by
unknown
04:27 queued 02:47
created
src/Command/ImportCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             $output->writeln("<info>Loading data from ${file}</info>");
227 227
 
228 228
             if (!array_key_exists('target', $doc->getData())) {
229
-                throw new MissingTargetException('Missing target in \'' . $file . '\'');
229
+                throw new MissingTargetException('Missing target in \''.$file.'\'');
230 230
             }
231 231
 
232 232
             $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']);
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
         $content = str_replace($rewriteHost, $rewriteTo, $doc->getContent());
273 273
         $uploadFile = $this->validateUploadFile($doc, $file);
274 274
 
275
-        $successFunc = function (ResponseInterface $response) use ($output) {
275
+        $successFunc = function(ResponseInterface $response) use ($output) {
276 276
             $output->writeln(
277
-                '<comment>Wrote ' . $response->getHeader('Link')[0] . '</comment>'
277
+                '<comment>Wrote '.$response->getHeader('Link')[0].'</comment>'
278 278
             );
279 279
         };
280 280
 
281
-        $errFunc = function (RequestException $e) use ($output, $file) {
281
+        $errFunc = function(RequestException $e) use ($output, $file) {
282 282
             $this->errors[$file] = $e->getMessage();
283 283
             $output->writeln(
284
-                '<error>' . str_pad(
284
+                '<error>'.str_pad(
285 285
                     sprintf(
286 286
                         'Failed to write <%s> from \'%s\' with message \'%s\'',
287 287
                         $e->getRequest()->getUri(),
@@ -290,17 +290,17 @@  discard block
 block discarded – undo
290 290
                     ),
291 291
                     140,
292 292
                     ' '
293
-                ) . '</error>'
293
+                ).'</error>'
294 294
             );
295 295
             if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
296 296
                 $this->dumper->dump(
297 297
                     $this->cloner->cloneVar(
298 298
                         $this->parser->parse($e->getResponse()->getBody(), false, false, true)
299 299
                     ),
300
-                    function ($line, $depth) use ($output) {
300
+                    function($line, $depth) use ($output) {
301 301
                         if ($depth > 0) {
302 302
                             $output->writeln(
303
-                                '<error>' . str_pad(str_repeat('  ', $depth) . $line, 140, ' ') . '</error>'
303
+                                '<error>'.str_pad(str_repeat('  ', $depth).$line, 140, ' ').'</error>'
304 304
                             );
305 305
                         }
306 306
                     }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             'headers'=> []
315 315
         ];
316 316
         if ($this->headerBasicAuth) {
317
-            $data['headers']['Authorization'] = 'Basic '. base64_encode($this->headerBasicAuth);
317
+            $data['headers']['Authorization'] = 'Basic '.base64_encode($this->headerBasicAuth);
318 318
         }
319 319
         if ($this->customHeaders) {
320 320
             foreach ($this->customHeaders as $headers) {
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
         // TODO This part, $uploadFile, promise should be removed once Graviton/File service is resolved in new Story.
334 334
         $fileRepeatFunc = false;
335 335
         if ($uploadFile) {
336
-            $fileRepeatFunc = function () use ($targetUrl, $successFunc, $errFunc, $output, $file, $data) {
336
+            $fileRepeatFunc = function() use ($targetUrl, $successFunc, $errFunc, $output, $file, $data) {
337 337
                 unset($this->errors[$file]);
338 338
                 $output->writeln('<info>File deleting: '.$targetUrl.'</info>');
339 339
                 $deleteRequest = $this->client->requestAsync('DELETE', $targetUrl);
340
-                $insert = function () use ($targetUrl, $successFunc, $errFunc, $output, $data) {
340
+                $insert = function() use ($targetUrl, $successFunc, $errFunc, $output, $data) {
341 341
                     $output->writeln('<info>File inserting: '.$targetUrl.'</info>');
342 342
                     $promiseInsert = $this->client->requestAsync('PUT', $targetUrl, $data);
343 343
                     $promiseInsert->then($successFunc, $errFunc);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         }
408 408
 
409 409
         // Find file
410
-        $fileName = dirname($originFile) . DIRECTORY_SEPARATOR . $documentData['file'];
410
+        $fileName = dirname($originFile).DIRECTORY_SEPARATOR.$documentData['file'];
411 411
         $fileName = str_replace('//', '/', $fileName);
412 412
         if (!file_exists($fileName)) {
413 413
             return false;
Please login to merge, or discard this patch.