Completed
Push — feature/modernize ( 7c5f32...3c43eb )
by Narcotic
02:12
created
src/Command/ImportCommand.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,7 +213,6 @@  discard block
 block discarded – undo
213 213
      * @param string          $host        host to import into
214 214
      * @param string          $rewriteHost string to replace with value from $rewriteTo during loading
215 215
      * @param string          $rewriteTo   string to replace value from $rewriteHost with during loading
216
-     * @param boolean         $sync        send requests syncronously
217 216
      * @param boolean         $noOverwrite should we not overwrite existing records?
218 217
      *
219 218
      * @return void
@@ -411,7 +410,7 @@  discard block
 block discarded – undo
411 410
      *
412 411
      * @param Document $doc        Data source for import data
413 412
      * @param string   $originFile Original full filename used toimport
414
-     * @return bool|mixed
413
+     * @return false|string
415 414
      */
416 415
     private function validateUploadFile(Document $doc, $originFile)
417 416
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             $output->writeln("<info>Loading data from ${file}</info>");
236 236
 
237 237
             if (!array_key_exists('target', $doc->getData())) {
238
-                throw new MissingTargetException('Missing target in \'' . $file . '\'');
238
+                throw new MissingTargetException('Missing target in \''.$file.'\'');
239 239
             }
240 240
 
241 241
             $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         // Authentication or custom headers.
285 285
         if ($this->headerBasicAuth) {
286
-            $data['headers']['Authorization'] = 'Basic '. base64_encode($this->headerBasicAuth);
286
+            $data['headers']['Authorization'] = 'Basic '.base64_encode($this->headerBasicAuth);
287 287
         }
288 288
         if ($this->customHeaders) {
289 289
             foreach ($this->customHeaders as $headers) {
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
             $response = $this->client->request('GET', $targetUrl, array_merge($data, ['http_errors' => false]));
301 301
             if ($response->getStatusCode() == 200) {
302 302
                 $output->writeln(
303
-                    '<info>' . str_pad(
303
+                    '<info>'.str_pad(
304 304
                         sprintf(
305 305
                             'Skipping <%s> as "no overwrite" is activated and it does exist.',
306 306
                             $targetUrl
307 307
                         ),
308 308
                         140,
309 309
                         ' '
310
-                    ) . '</info>'
310
+                    ).'</info>'
311 311
                 );
312 312
                 return;
313 313
             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                     $output->writeln('<info>File deleted: '.$targetUrl.'</info>');
322 322
                 } catch (\Exception $e) {
323 323
                     $output->writeln(
324
-                        '<error>' . str_pad(
324
+                        '<error>'.str_pad(
325 325
                             sprintf(
326 326
                                 'Failed to delete <%s> with message \'%s\'',
327 327
                                 $targetUrl,
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                             ),
330 330
                             140,
331 331
                             ' '
332
-                        ) . '</error>'
332
+                        ).'</error>'
333 333
                     );
334 334
                 }
335 335
             }
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
             );
342 342
 
343 343
             $output->writeln(
344
-                '<comment>Wrote ' . $response->getHeader('Link')[0] . '</comment>'
344
+                '<comment>Wrote '.$response->getHeader('Link')[0].'</comment>'
345 345
             );
346 346
         } catch (\Exception $e) {
347 347
             $this->errors[$file] = $e->getMessage();
348 348
             $output->writeln(
349
-                '<error>' . str_pad(
349
+                '<error>'.str_pad(
350 350
                     sprintf(
351 351
                         'Failed to write <%s> from \'%s\' with message \'%s\'',
352 352
                         $e->getRequest()->getUri(),
@@ -355,17 +355,17 @@  discard block
 block discarded – undo
355 355
                     ),
356 356
                     140,
357 357
                     ' '
358
-                ) . '</error>'
358
+                ).'</error>'
359 359
             );
360 360
             if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
361 361
                 $this->dumper->dump(
362 362
                     $this->cloner->cloneVar(
363 363
                         $this->parser->parse($e->getResponse()->getBody(), false, false, true)
364 364
                     ),
365
-                    function ($line, $depth) use ($output) {
365
+                    function($line, $depth) use ($output) {
366 366
                         if ($depth > 0) {
367 367
                             $output->writeln(
368
-                                '<error>' . str_pad(str_repeat('  ', $depth) . $line, 140, ' ') . '</error>'
368
+                                '<error>'.str_pad(str_repeat('  ', $depth).$line, 140, ' ').'</error>'
369 369
                             );
370 370
                         }
371 371
                     }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         }
423 423
 
424 424
         // Find file
425
-        $fileName = dirname($originFile) . DIRECTORY_SEPARATOR . $documentData['file'];
425
+        $fileName = dirname($originFile).DIRECTORY_SEPARATOR.$documentData['file'];
426 426
         $fileName = str_replace('//', '/', $fileName);
427 427
         if (!file_exists($fileName)) {
428 428
             return false;
Please login to merge, or discard this patch.