Completed
Push — feature/sentry-and-update ( 08707d )
by Narcotic
03:24
created
src/Command/CoreImportCommand.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
     /**
98 98
      * import a single file into a collection
99 99
      *
100
-     * @param SplFileInfo     $file   file
100
+     * @param \SplFileInfo     $file   file
101 101
      * @param InputInterface  $input  User input on console
102 102
      * @param OutputInterface $output Output of the command
103 103
      *
Please login to merge, or discard this patch.
src/Command/ImportCommand.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
      *
345 345
      * @param Document $doc        Data source for import data
346 346
      * @param string   $originFile Original full filename used toimport
347
-     * @return bool|mixed
347
+     * @return false|string
348 348
      */
349 349
     private function validateUploadFile(Document $doc, $originFile)
350 350
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $this->logger->info("Loading data from ${file}");
243 243
 
244 244
             if (!array_key_exists('target', $doc->getData())) {
245
-                throw new MissingTargetException('Missing target in \'' . $file . '\'');
245
+                throw new MissingTargetException('Missing target in \''.$file.'\'');
246 246
             }
247 247
 
248 248
             $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
         // Authentication or custom headers.
292 292
         if ($this->headerBasicAuth) {
293
-            $data['headers']['Authorization'] = 'Basic '. base64_encode($this->headerBasicAuth);
293
+            $data['headers']['Authorization'] = 'Basic '.base64_encode($this->headerBasicAuth);
294 294
         }
295 295
         if ($this->customHeaders) {
296 296
             foreach ($this->customHeaders as $headers) {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                 $data
341 341
             );
342 342
 
343
-            $this->logger->info('Wrote ' . $response->getHeader('Link')[0]);
343
+            $this->logger->info('Wrote '.$response->getHeader('Link')[0]);
344 344
         } catch (\Exception $e) {
345 345
             $this->errors[$file] = $e->getMessage();
346 346
             $this->logger->error(
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
                     $this->cloner->cloneVar(
358 358
                         $this->parser->parse($e->getResponse()->getBody(), false, false, true)
359 359
                     ),
360
-                    function ($line, $depth) use ($output) {
360
+                    function($line, $depth) use ($output) {
361 361
                         if ($depth > 0) {
362 362
                             $output->writeln(
363
-                                '<error>' . str_pad(str_repeat('  ', $depth) . $line, 140, ' ') . '</error>'
363
+                                '<error>'.str_pad(str_repeat('  ', $depth).$line, 140, ' ').'</error>'
364 364
                             );
365 365
                         }
366 366
                     }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         }
418 418
 
419 419
         // Find file
420
-        $fileName = dirname($originFile) . DIRECTORY_SEPARATOR . $documentData['file'];
420
+        $fileName = dirname($originFile).DIRECTORY_SEPARATOR.$documentData['file'];
421 421
         $fileName = str_replace('//', '/', $fileName);
422 422
         if (!file_exists($fileName)) {
423 423
             return false;
Please login to merge, or discard this patch.
src/Command/ValidationCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,15 +84,15 @@
 block discarded – undo
84 84
     protected function execute(InputInterface $input, OutputInterface $output)
85 85
     {
86 86
         $files = $input->getArgument('file');
87
-        $finder =  new Finder();
87
+        $finder = new Finder();
88 88
         $finder = $finder->files();
89 89
 
90 90
         /**
91 91
          * @param SplFileInfo $file
92 92
          * @return bool
93 93
          */
94
-        $filter = function (SplFileInfo $file) {
95
-            if (!in_array($file->getExtension(), ['yml','json']) || $file->isDir()) {
94
+        $filter = function(SplFileInfo $file) {
95
+            if (!in_array($file->getExtension(), ['yml', 'json']) || $file->isDir()) {
96 96
                 return false;
97 97
             }
98 98
             return true;
Please login to merge, or discard this patch.
src/Command/ImportCommandAbstract.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      *
60 60
      * @param InputInterface $input User input on console
61 61
      *
62
-     * @return Finder|SplFileInfo[] finder
62
+     * @return Finder finder
63 63
      */
64 64
     protected function getFinder($input)
65 65
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         try {
50 50
             $exitCode = $this->doImport($this->getFinder($input), $input, $output);
51 51
         } catch (MissingTargetException $e) {
52
-            $output->writeln('<error>' . $e->getMessage() . '</error>');
52
+            $output->writeln('<error>'.$e->getMessage().'</error>');
53 53
         }
54 54
         return $exitCode;
55 55
     }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
          * @param SplFileInfo $file
77 77
          * @return bool
78 78
          */
79
-        $filter = function (SplFileInfo $file) {
80
-            if (!in_array($file->getExtension(), ['yml','json']) || $file->isDir()) {
79
+        $filter = function(SplFileInfo $file) {
80
+            if (!in_array($file->getExtension(), ['yml', 'json']) || $file->isDir()) {
81 81
                 return false;
82 82
             }
83 83
             return true;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
             $fileList = array_filter(
104 104
                 $fileList,
105
-                function ($val) {
105
+                function($val) {
106 106
                     if (!empty($val)) {
107 107
                         return true;
108 108
                     }
Please login to merge, or discard this patch.
src/Command/CoreExportCommand.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Graviton\ImportExport\Util\JsonSerializer;
9 9
 use Symfony\Component\Console\Command\Command;
10 10
 use Symfony\Component\Console\Input\InputArgument;
11
-
12 11
 use Symfony\Component\Console\Input\InputInterface;
13 12
 use Symfony\Component\Console\Input\InputOption;
14 13
 use Symfony\Component\Console\Output\OutputInterface;
Please login to merge, or discard this patch.
test/Command/CoreImportCommandTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $clientMock = $this->getMockBuilder('\MongoClient')->disableOriginalConstructor()->getMock();
52 52
 
53 53
         $collectionMock = $this->getMockBuilder('\MongoCollection')->disableOriginalConstructor()->getMock();
54
-        $collectionMock->method('save')->will($this->returnCallback(array($this,'saveCollectionCallback')));
54
+        $collectionMock->method('save')->will($this->returnCallback(array($this, 'saveCollectionCallback')));
55 55
 
56 56
         $dbMock = $this->getMockBuilder('\MongoDB')->disableOriginalConstructor()->getMock();
57 57
         $dbMock->method('selectCollection')->willReturn($collectionMock);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
         // fail in output?
128 128
         $this->assertContains(
129
-            'Error in <' . $this->sourceDir . '/Dudess/Invalid.json>: Invalid JSON to unserialize.',
129
+            'Error in <'.$this->sourceDir.'/Dudess/Invalid.json>: Invalid JSON to unserialize.',
130 130
             $this->cmdTester->getDisplay()
131 131
         );
132 132
         $this->assertEquals(1, $this->cmdTester->getStatusCode());
Please login to merge, or discard this patch.
test/Command/ImportCommandTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $responseMock
46 46
             ->method('getHeader')
47 47
             ->with('Link')
48
-            ->willReturn(['<' . $host . $path . '>; rel="self"']);
48
+            ->willReturn(['<'.$host.$path.'>; rel="self"']);
49 49
 
50 50
         $clientMock
51 51
             ->method('request')
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
         $cmdTester = $this->getTester($sut, $file);
64 64
 
65
-        $this->assertContains('Loading data from ' . $file, $cmdTester->getDisplay());
66
-        $this->assertContains('Wrote <' . $host . $path . '>; rel="self"', $cmdTester->getDisplay());
65
+        $this->assertContains('Loading data from '.$file, $cmdTester->getDisplay());
66
+        $this->assertContains('Wrote <'.$host.$path.'>; rel="self"', $cmdTester->getDisplay());
67 67
         $this->assertEquals(0, $cmdTester->getStatusCode());
68 68
     }
69 69
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
         return [
76 76
             'basic valid file' => [
77 77
                 'http://localhost',
78
-                __DIR__ . '/fixtures/set-01/test-2.json',
78
+                __DIR__.'/fixtures/set-01/test-2.json',
79 79
                 '/core/app/test',
80 80
             ],
81 81
             'basic valid image file' => [
82 82
                 'http://localhost',
83
-                __DIR__ . '/fixtures/file',
83
+                __DIR__.'/fixtures/file',
84 84
                 '/core/app/test',
85 85
             ],
86 86
         ];
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
         $responseMock
108 108
             ->method('getHeader')
109 109
             ->with('Link')
110
-            ->willReturn(['<' . $host . $file . '>; rel="self"']);
110
+            ->willReturn(['<'.$host.$file.'>; rel="self"']);
111 111
 
112 112
         $requestMock = $this->createMock('Psr\Http\Message\RequestInterface');
113 113
         $requestMock
114 114
             ->method('getUri')
115
-            ->willReturn($host . '/core/app/test');
115
+            ->willReturn($host.'/core/app/test');
116 116
 
117 117
         $exceptionMock = $this->getMockBuilder('GuzzleHttp\Exception\RequestException')
118 118
             ->setConstructorArgs(['Client error: 400', $requestMock, $responseMock])
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         $cmdTester = $this->getTester($sut, $file);
143 143
 
144
-        $this->assertContains('Loading data from ' . $file, $cmdTester->getDisplay());
144
+        $this->assertContains('Loading data from '.$file, $cmdTester->getDisplay());
145 145
         foreach ($errors as $error) {
146 146
             $this->assertContains(
147 147
                 $error,
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
         return [
160 160
             'invalid file (server side)' => [
161 161
                 'http://localhost',
162
-                __DIR__ . '/fixtures/set-01/test.json',
162
+                __DIR__.'/fixtures/set-01/test.json',
163 163
                 [
164
-                    'Failed to write <http://localhost/core/app/test> from \'' .
165
-                    __DIR__ . '/fixtures/set-01/test.json\' with message \'Client error: 400\'',
164
+                    'Failed to write <http://localhost/core/app/test> from \''.
165
+                    __DIR__.'/fixtures/set-01/test.json\' with message \'Client error: 400\'',
166 166
                     '"message": "invalid"',
167 167
                 ],
168 168
             ],
169 169
             'missing target in file (user error)' => [
170 170
                 'http://localhost',
171
-                __DIR__ . '/fixtures/set-01/test-3.json',
171
+                __DIR__.'/fixtures/set-01/test-3.json',
172 172
                 [
173
-                    'Missing target in \'' . __DIR__ . '/fixtures/set-01/test-3.json\'',
173
+                    'Missing target in \''.__DIR__.'/fixtures/set-01/test-3.json\'',
174 174
                 ],
175 175
             ]
176 176
         ];
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
         $cmdTester = $this->getTester(
219 219
             $sut,
220
-            __DIR__ . '/fixtures/set-01/test-4.json',
220
+            __DIR__.'/fixtures/set-01/test-4.json',
221 221
             [
222 222
                 'host' => 'http://example.com',
223 223
                 '--rewrite-host' => 'http://localhost'
Please login to merge, or discard this patch.