@@ -10,7 +10,6 @@ |
||
| 10 | 10 | namespace Graviton\ImportExport\Command; |
| 11 | 11 | |
| 12 | 12 | use Graviton\ImportExport\Exception\MissingTargetException; |
| 13 | -use Graviton\ImportExport\Exception\JsonParseException; |
|
| 14 | 13 | use Graviton\ImportExport\Exception\ParseException; |
| 15 | 14 | use Graviton\ImportExport\Exception\UnknownFileTypeException; |
| 16 | 15 | use Graviton\ImportExport\Service\HttpClient; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $this->logger->info("Loading data from ${file}"); |
| 245 | 245 | |
| 246 | 246 | if (!array_key_exists('target', $doc->getData())) { |
| 247 | - throw new MissingTargetException('Missing target in \'' . $file . '\''); |
|
| 247 | + throw new MissingTargetException('Missing target in \''.$file.'\''); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | // Authentication or custom headers. |
| 294 | 294 | if ($this->headerBasicAuth) { |
| 295 | - $data['headers']['Authorization'] = 'Basic '. base64_encode($this->headerBasicAuth); |
|
| 295 | + $data['headers']['Authorization'] = 'Basic '.base64_encode($this->headerBasicAuth); |
|
| 296 | 296 | } |
| 297 | 297 | if ($this->customHeaders) { |
| 298 | 298 | foreach ($this->customHeaders as $headers) { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $data |
| 343 | 343 | ); |
| 344 | 344 | |
| 345 | - $this->logger->info('Wrote ' . $response->getHeader('Link')[0]); |
|
| 345 | + $this->logger->info('Wrote '.$response->getHeader('Link')[0]); |
|
| 346 | 346 | } catch (\Exception $e) { |
| 347 | 347 | $this->errors[$file] = $e->getMessage(); |
| 348 | 348 | $this->logger->error( |
@@ -359,10 +359,10 @@ discard block |
||
| 359 | 359 | $this->cloner->cloneVar( |
| 360 | 360 | $this->parser->parse($e->getResponse()->getBody(), Yaml::PARSE_OBJECT_FOR_MAP) |
| 361 | 361 | ), |
| 362 | - function ($line, $depth) use ($output) { |
|
| 362 | + function($line, $depth) use ($output) { |
|
| 363 | 363 | if ($depth > 0) { |
| 364 | 364 | $output->writeln( |
| 365 | - '<error>' . str_pad(str_repeat(' ', $depth) . $line, 140, ' ') . '</error>' |
|
| 365 | + '<error>'.str_pad(str_repeat(' ', $depth).$line, 140, ' ').'</error>' |
|
| 366 | 366 | ); |
| 367 | 367 | } |
| 368 | 368 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // Find file |
| 434 | - $fileName = dirname($originFile) . DIRECTORY_SEPARATOR . $documentData['file']; |
|
| 434 | + $fileName = dirname($originFile).DIRECTORY_SEPARATOR.$documentData['file']; |
|
| 435 | 435 | $fileName = str_replace('//', '/', $fileName); |
| 436 | 436 | if (!file_exists($fileName)) { |
| 437 | 437 | return false; |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | public static function getFullStringFromLog(TestHandler $handler) |
| 40 | 40 | { |
| 41 | 41 | $entries = array_map( |
| 42 | - function ($val) { |
|
| 42 | + function($val) { |
|
| 43 | 43 | return $val['formatted']; |
| 44 | 44 | }, |
| 45 | 45 | $handler->getRecords() |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $responseMock |
| 47 | 47 | ->method('getHeader') |
| 48 | 48 | ->with('Link') |
| 49 | - ->willReturn(['<' . $host . $path . '>; rel="self"']); |
|
| 49 | + ->willReturn(['<'.$host.$path.'>; rel="self"']); |
|
| 50 | 50 | |
| 51 | 51 | $clientMock |
| 52 | 52 | ->method('request') |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | $cmdTester = $this->getTester($sut, $file); |
| 68 | 68 | $display = TestUtils::getFullStringFromLog($logger->getHandlers()[0]); |
| 69 | 69 | |
| 70 | - $this->assertContains('Loading data from ' . $file, $display); |
|
| 71 | - $this->assertContains('Wrote <' . $host . $path . '>; rel="self"', $display); |
|
| 70 | + $this->assertContains('Loading data from '.$file, $display); |
|
| 71 | + $this->assertContains('Wrote <'.$host.$path.'>; rel="self"', $display); |
|
| 72 | 72 | $this->assertEquals(0, $cmdTester->getStatusCode()); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | return [ |
| 81 | 81 | 'basic valid file' => [ |
| 82 | 82 | 'http://localhost', |
| 83 | - __DIR__ . '/fixtures/set-01/test-2.json', |
|
| 83 | + __DIR__.'/fixtures/set-01/test-2.json', |
|
| 84 | 84 | '/core/app/test', |
| 85 | 85 | ], |
| 86 | 86 | 'basic valid image file' => [ |
| 87 | 87 | 'http://localhost', |
| 88 | - __DIR__ . '/fixtures/file', |
|
| 88 | + __DIR__.'/fixtures/file', |
|
| 89 | 89 | '/core/app/test', |
| 90 | 90 | ], |
| 91 | 91 | ]; |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | $responseMock |
| 113 | 113 | ->method('getHeader') |
| 114 | 114 | ->with('Link') |
| 115 | - ->willReturn(['<' . $host . $file . '>; rel="self"']); |
|
| 115 | + ->willReturn(['<'.$host.$file.'>; rel="self"']); |
|
| 116 | 116 | |
| 117 | 117 | $requestMock = $this->createMock('Psr\Http\Message\RequestInterface'); |
| 118 | 118 | $requestMock |
| 119 | 119 | ->method('getUri') |
| 120 | - ->willReturn($host . '/core/app/test'); |
|
| 120 | + ->willReturn($host.'/core/app/test'); |
|
| 121 | 121 | |
| 122 | 122 | $exceptionMock = $this->getMockBuilder('GuzzleHttp\Exception\RequestException') |
| 123 | 123 | ->setConstructorArgs(['Client error: 400', $requestMock, $responseMock]) |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $cmdTester = $this->getTester($sut, $file); |
| 151 | 151 | $display = TestUtils::getFullStringFromLog($logger->getHandlers()[0]); |
| 152 | 152 | |
| 153 | - $this->assertContains('Loading data from ' . $file, $display); |
|
| 153 | + $this->assertContains('Loading data from '.$file, $display); |
|
| 154 | 154 | foreach ($errors as $error) { |
| 155 | 155 | $this->assertContains( |
| 156 | 156 | $error, |
@@ -168,18 +168,18 @@ discard block |
||
| 168 | 168 | return [ |
| 169 | 169 | 'invalid file (server side)' => [ |
| 170 | 170 | 'http://localhost', |
| 171 | - __DIR__ . '/fixtures/set-01/test.json', |
|
| 171 | + __DIR__.'/fixtures/set-01/test.json', |
|
| 172 | 172 | [ |
| 173 | - 'Failed to write <http://localhost/core/app/test> from \'' . |
|
| 174 | - __DIR__ . '/fixtures/set-01/test.json\' with message \'Client error: 400\'', |
|
| 173 | + 'Failed to write <http://localhost/core/app/test> from \''. |
|
| 174 | + __DIR__.'/fixtures/set-01/test.json\' with message \'Client error: 400\'', |
|
| 175 | 175 | '"message": "invalid"', |
| 176 | 176 | ], |
| 177 | 177 | ], |
| 178 | 178 | 'missing target in file (user error)' => [ |
| 179 | 179 | 'http://localhost', |
| 180 | - __DIR__ . '/fixtures/set-01/test-3.json', |
|
| 180 | + __DIR__.'/fixtures/set-01/test-3.json', |
|
| 181 | 181 | [ |
| 182 | - 'Missing target in \'' . __DIR__ . '/fixtures/set-01/test-3.json\'', |
|
| 182 | + 'Missing target in \''.__DIR__.'/fixtures/set-01/test-3.json\'', |
|
| 183 | 183 | ], |
| 184 | 184 | ] |
| 185 | 185 | ]; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $cmdTester = $this->getTester( |
| 231 | 231 | $sut, |
| 232 | - __DIR__ . '/fixtures/set-01/test-4.json', |
|
| 232 | + __DIR__.'/fixtures/set-01/test-4.json', |
|
| 233 | 233 | [ |
| 234 | 234 | 'host' => 'http://example.com', |
| 235 | 235 | '--rewrite-host' => 'http://localhost' |