@@ -97,7 +97,7 @@ |
||
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 | * |
@@ -211,7 +211,7 @@ |
||
211 | 211 | * @param string $rewriteTo string to replace value from $rewriteHost with during loading |
212 | 212 | * @param boolean $sync send requests syncronously |
213 | 213 | * |
214 | - * @return Promise\Promise|null |
|
214 | + * @return Promise\PromiseInterface |
|
215 | 215 | */ |
216 | 216 | protected function importResource( |
217 | 217 | $targetUrl, |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $output->writeln("<info>Loading data from ${file}</info>"); |
178 | 178 | |
179 | 179 | if (!array_key_exists('target', $doc->getData())) { |
180 | - throw new MissingTargetException('Missing target in \'' . $file . '\''); |
|
180 | + throw new MissingTargetException('Missing target in \''.$file.'\''); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $targetUrl = sprintf('%s%s', $host, $doc->getData()['target']); |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | ) { |
226 | 226 | $content = str_replace($rewriteHost, $rewriteTo, $doc->getContent()); |
227 | 227 | |
228 | - $successFunc = function (ResponseInterface $response) use ($output) { |
|
228 | + $successFunc = function(ResponseInterface $response) use ($output) { |
|
229 | 229 | $output->writeln( |
230 | - '<comment>Wrote ' . $response->getHeader('Link')[0] . '</comment>' |
|
230 | + '<comment>Wrote '.$response->getHeader('Link')[0].'</comment>' |
|
231 | 231 | ); |
232 | 232 | }; |
233 | 233 | |
234 | - $errFunc = function (RequestException $e) use ($output, $file) { |
|
234 | + $errFunc = function(RequestException $e) use ($output, $file) { |
|
235 | 235 | $output->writeln( |
236 | - '<error>' . str_pad( |
|
236 | + '<error>'.str_pad( |
|
237 | 237 | sprintf( |
238 | 238 | 'Failed to write <%s> from \'%s\' with message \'%s\'', |
239 | 239 | $e->getRequest()->getUri(), |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | ), |
243 | 243 | 140, |
244 | 244 | ' ' |
245 | - ) . '</error>' |
|
245 | + ).'</error>' |
|
246 | 246 | ); |
247 | 247 | if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { |
248 | 248 | $this->dumper->dump( |
249 | 249 | $this->cloner->cloneVar( |
250 | 250 | $this->parser->parse($e->getResponse()->getBody(), false, false, true) |
251 | 251 | ), |
252 | - function ($line, $depth) use ($output) { |
|
252 | + function($line, $depth) use ($output) { |
|
253 | 253 | if ($depth > 0) { |
254 | 254 | $output->writeln( |
255 | - '<error>' . str_pad(str_repeat(' ', $depth) . $line, 140, ' ') . '</error>' |
|
255 | + '<error>'.str_pad(str_repeat(' ', $depth).$line, 140, ' ').'</error>' |
|
256 | 256 | ); |
257 | 257 | } |
258 | 258 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $clientMock = $this->getMockBuilder('\MongoClient')->disableOriginalConstructor()->getMock(); |
52 | 52 | |
53 | 53 | $collection = $this->getMockBuilder('\MongoCollection')->disableOriginalConstructor()->getMock(); |
54 | - $collection->method('save')->will($this->returnCallback(array($this,'saveCollectionCallback'))); |
|
54 | + $collection->method('save')->will($this->returnCallback(array($this, 'saveCollectionCallback'))); |
|
55 | 55 | $clientMock->method('selectCollection')->willReturn($collection); |
56 | 56 | |
57 | 57 | $sut = new CoreImportCommand( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // fail in output? |
114 | 114 | $this->assertContains( |
115 | - 'Could not deserialize file <' . $this->sourceDir . '/Dudess/Invalid.json>', |
|
115 | + 'Could not deserialize file <'.$this->sourceDir.'/Dudess/Invalid.json>', |
|
116 | 116 | $this->cmdTester->getDisplay() |
117 | 117 | ); |
118 | 118 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param SplFileInfo $file |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - $filter = function (SplFileInfo $file) { |
|
56 | - if (!in_array($file->getExtension(), ['yml','json']) || $file->isDir()) { |
|
55 | + $filter = function(SplFileInfo $file) { |
|
56 | + if (!in_array($file->getExtension(), ['yml', 'json']) || $file->isDir()) { |
|
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | return true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | try { |
65 | 65 | $this->doImport($finder, $input, $output); |
66 | 66 | } catch (MissingTargetException $e) { |
67 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
67 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | $responseMock |
52 | 52 | ->method('getHeader') |
53 | 53 | ->with('Link') |
54 | - ->willReturn(['<' . $host . $path . '>; rel="self"']); |
|
54 | + ->willReturn(['<'.$host.$path.'>; rel="self"']); |
|
55 | 55 | |
56 | 56 | $promiseMock |
57 | 57 | ->method('then') |
58 | 58 | ->will( |
59 | 59 | $this->returnCallback( |
60 | - function ($ok) use ($responseMock) { |
|
60 | + function($ok) use ($responseMock) { |
|
61 | 61 | $ok($responseMock); |
62 | 62 | } |
63 | 63 | ) |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | $cmdTester = $this->getTester($sut, $file); |
76 | 76 | |
77 | - $this->assertContains('Loading data from ' . $file, $cmdTester->getDisplay()); |
|
78 | - $this->assertContains('Wrote <' . $host . $path . '>; rel="self"', $cmdTester->getDisplay()); |
|
77 | + $this->assertContains('Loading data from '.$file, $cmdTester->getDisplay()); |
|
78 | + $this->assertContains('Wrote <'.$host.$path.'>; rel="self"', $cmdTester->getDisplay()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return [ |
87 | 87 | 'basic valid file' => [ |
88 | 88 | 'http://localhost', |
89 | - __DIR__ . '/fixtures/set-01/test-2.json', |
|
89 | + __DIR__.'/fixtures/set-01/test-2.json', |
|
90 | 90 | '/core/app/test', |
91 | 91 | ], |
92 | 92 | ]; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return [ |
101 | 101 | 'basic valid image file' => [ |
102 | 102 | 'http://localhost', |
103 | - __DIR__ . '/fixtures/file', |
|
103 | + __DIR__.'/fixtures/file', |
|
104 | 104 | '/core/app/test', |
105 | 105 | ], |
106 | 106 | ]; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $requestMock = $this->getMock('Psr\Http\Message\RequestInterface'); |
135 | 135 | $requestMock |
136 | 136 | ->method('getUri') |
137 | - ->willReturn($host . '/core/app/test'); |
|
137 | + ->willReturn($host.'/core/app/test'); |
|
138 | 138 | |
139 | 139 | $exceptionMock = $this->getMockBuilder('GuzzleHttp\Exception\RequestException') |
140 | 140 | ->setConstructorArgs(['Client error: 400', $requestMock, $responseMock]) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | ->method('then') |
153 | 153 | ->will( |
154 | 154 | $this->returnCallback( |
155 | - function ($ok, $nok) use ($exceptionMock) { |
|
155 | + function($ok, $nok) use ($exceptionMock) { |
|
156 | 156 | return $nok($exceptionMock); |
157 | 157 | } |
158 | 158 | ) |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $cmdTester = $this->getTester($sut, $file); |
171 | 171 | |
172 | - $this->assertContains('Loading data from ' . $file, $cmdTester->getDisplay()); |
|
172 | + $this->assertContains('Loading data from '.$file, $cmdTester->getDisplay()); |
|
173 | 173 | foreach ($errors as $error) { |
174 | 174 | $this->assertContains( |
175 | 175 | $error, |
@@ -186,18 +186,18 @@ discard block |
||
186 | 186 | return [ |
187 | 187 | 'invalid file (server side)' => [ |
188 | 188 | 'http://localhost', |
189 | - __DIR__ . '/fixtures/set-01/test.json', |
|
189 | + __DIR__.'/fixtures/set-01/test.json', |
|
190 | 190 | [ |
191 | - 'Failed to write <http://localhost/core/app/test> from \'' . |
|
192 | - __DIR__ . '/fixtures/set-01/test.json\' with message \'Client error: 400\'', |
|
191 | + 'Failed to write <http://localhost/core/app/test> from \''. |
|
192 | + __DIR__.'/fixtures/set-01/test.json\' with message \'Client error: 400\'', |
|
193 | 193 | '"message": "invalid"', |
194 | 194 | ], |
195 | 195 | ], |
196 | 196 | 'missing target in file (user error)' => [ |
197 | 197 | 'http://localhost', |
198 | - __DIR__ . '/fixtures/set-01/test-3.json', |
|
198 | + __DIR__.'/fixtures/set-01/test-3.json', |
|
199 | 199 | [ |
200 | - 'Missing target in \'' . __DIR__ . '/fixtures/set-01/test-3.json\'', |
|
200 | + 'Missing target in \''.__DIR__.'/fixtures/set-01/test-3.json\'', |
|
201 | 201 | ], |
202 | 202 | ] |
203 | 203 | ]; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | ->method('then') |
235 | 235 | ->will( |
236 | 236 | $this->returnCallback( |
237 | - function ($ok) use ($responseMock) { |
|
237 | + function($ok) use ($responseMock) { |
|
238 | 238 | $ok($responseMock); |
239 | 239 | } |
240 | 240 | ) |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | $cmdTester = $this->getTester( |
253 | 253 | $sut, |
254 | - __DIR__ . '/fixtures/set-01/test-4.json', |
|
254 | + __DIR__.'/fixtures/set-01/test-4.json', |
|
255 | 255 | [ |
256 | 256 | 'host' => 'http://example.com', |
257 | 257 | '--rewrite-host' => 'http://localhost' |