@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | // should we filter collection names? |
141 | 141 | $collectionNameFilter = $input->getOption('collection'); |
142 | 142 | if (!is_null($collectionNameFilter)) { |
143 | - $collectionNameFilter = '/^'.str_replace('*', '(.*)', $collectionNameFilter).'/i'; |
|
143 | + $collectionNameFilter = '/^' . str_replace('*', '(.*)', $collectionNameFilter) . '/i'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | foreach ($this->mongoClient->{$this->databaseName}->listCollections() as $collection) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | - $collectionDestinationDir = $destinationDir.$collection->getName().DIRECTORY_SEPARATOR; |
|
151 | + $collectionDestinationDir = $destinationDir . $collection->getName() . DIRECTORY_SEPARATOR; |
|
152 | 152 | |
153 | 153 | if (!$this->fs->exists($collectionDestinationDir)) { |
154 | 154 | $this->fs->mkdir($collectionDestinationDir); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ); |
194 | 194 | |
195 | 195 | $doc = new Document($content, ['collection' => $collectionName]); |
196 | - $fileName = $destinationDir.$record['_id'].'.json'; |
|
196 | + $fileName = $destinationDir . $record['_id'] . '.json'; |
|
197 | 197 | |
198 | 198 | $this->fs->dumpFile($fileName, $this->frontMatter->dump($doc)); |
199 | 199 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * dumps data from a mongodb connection to files |
|
4 | - */ |
|
3 | + * dumps data from a mongodb connection to files |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Command; |
7 | 7 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * import objects into mongodb with files created by CoreExportCommand |
|
4 | - */ |
|
3 | + * import objects into mongodb with files created by CoreExportCommand |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Command; |
7 | 7 |
@@ -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 | * |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * drops all collections in a given mongodb database |
|
4 | - */ |
|
3 | + * drops all collections in a given mongodb database |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Command; |
7 | 7 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * import json data into graviton |
|
4 | - * |
|
5 | - * Supports importing json data from either a single file or a complete folder of files. |
|
6 | - * |
|
7 | - * The data needs to contain frontmatter to hint where the bits and pieces should go. |
|
8 | - */ |
|
3 | + * import json data into graviton |
|
4 | + * |
|
5 | + * Supports importing json data from either a single file or a complete folder of files. |
|
6 | + * |
|
7 | + * The data needs to contain frontmatter to hint where the bits and pieces should go. |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | namespace Graviton\ImportExport\Command; |
11 | 11 |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | ) { |
197 | 197 | $content = str_replace($rewriteHost, $host, $doc->getContent()); |
198 | 198 | |
199 | - $successFunc = function (ResponseInterface $response) use ($output) { |
|
199 | + $successFunc = function(ResponseInterface $response) use ($output) { |
|
200 | 200 | $output->writeln( |
201 | 201 | '<comment>Wrote ' . $response->getHeader('Link')[0] . '</comment>' |
202 | 202 | ); |
203 | 203 | }; |
204 | 204 | |
205 | - $errFunc = function (RequestException $e) use ($output, $file) { |
|
205 | + $errFunc = function(RequestException $e) use ($output, $file) { |
|
206 | 206 | $output->writeln( |
207 | 207 | '<error>' . str_pad( |
208 | 208 | sprintf( |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $this->cloner->cloneVar( |
221 | 221 | $this->parser->parse($e->getResponse()->getBody(), false, false, true) |
222 | 222 | ), |
223 | - function ($line, $depth) use ($output) { |
|
223 | + function($line, $depth) use ($output) { |
|
224 | 224 | if ($depth > 0) { |
225 | 225 | $output->writeln( |
226 | 226 | '<error>' . str_pad(str_repeat(' ', $depth) . $line, 140, ' ') . '</error>' |
@@ -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, |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * base abstract for import based commands where a bunch of file must be collected and |
|
4 | - * done something with them.. |
|
5 | - */ |
|
3 | + * base abstract for import based commands where a bunch of file must be collected and |
|
4 | + * done something with them.. |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Graviton\ImportExport\Command; |
8 | 8 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * check core export command |
|
4 | - */ |
|
3 | + * check core export command |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Tests\Command; |
7 | 7 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->cmdTester = new CommandTester($cmd); |
92 | 92 | |
93 | 93 | $this->fs = new Filesystem(); |
94 | - $this->destinationDir = __DIR__.DIRECTORY_SEPARATOR.'exportTemp'.DIRECTORY_SEPARATOR; |
|
94 | + $this->destinationDir = __DIR__ . DIRECTORY_SEPARATOR . 'exportTemp' . DIRECTORY_SEPARATOR; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | // see if directories and files exist and contents.. |
116 | - $this->assertTrue(is_dir($this->destinationDir.'Dude')); |
|
116 | + $this->assertTrue(is_dir($this->destinationDir . 'Dude')); |
|
117 | 117 | |
118 | - $file = $this->destinationDir.'Dude'.DIRECTORY_SEPARATOR.'Record1.json'; |
|
118 | + $file = $this->destinationDir . 'Dude' . DIRECTORY_SEPARATOR . 'Record1.json'; |
|
119 | 119 | $this->assertFileExists($file); |
120 | 120 | $contents = file_get_contents($file); |
121 | 121 | $this->assertContains('collection: Dude', $contents); |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | $this->assertContains('"name": "Fred",', $contents); |
124 | 124 | $this->assertContains('"@type": "MongoDate"', $contents); |
125 | 125 | |
126 | - $this->assertFileExists($this->destinationDir.'Dude'.DIRECTORY_SEPARATOR.'Record2.json'); |
|
126 | + $this->assertFileExists($this->destinationDir . 'Dude' . DIRECTORY_SEPARATOR . 'Record2.json'); |
|
127 | 127 | |
128 | - $this->assertTrue(is_dir($this->destinationDir.'Dudess')); |
|
129 | - $this->assertFileExists($this->destinationDir.'Dudess'.DIRECTORY_SEPARATOR.'Record3.json'); |
|
130 | - $this->assertFileExists($this->destinationDir.'Dudess'.DIRECTORY_SEPARATOR.'Record4.json'); |
|
128 | + $this->assertTrue(is_dir($this->destinationDir . 'Dudess')); |
|
129 | + $this->assertFileExists($this->destinationDir . 'Dudess' . DIRECTORY_SEPARATOR . 'Record3.json'); |
|
130 | + $this->assertFileExists($this->destinationDir . 'Dudess' . DIRECTORY_SEPARATOR . 'Record4.json'); |
|
131 | 131 | |
132 | 132 | // does the ignored not exist? |
133 | - $this->assertFalse(is_dir($this->destinationDir.'Franz')); |
|
133 | + $this->assertFalse(is_dir($this->destinationDir . 'Franz')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * check core import command |
|
4 | - */ |
|
3 | + * check core import command |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Tests\Command; |
7 | 7 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $clientMock = $this->getMockBuilder('\MongoClient')->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( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->cmdTester = new CommandTester($cmd); |
71 | 71 | |
72 | 72 | $this->fs = new Filesystem(); |
73 | - $this->sourceDir = __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'core-import'; |
|
73 | + $this->sourceDir = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'core-import'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * check core purge command |
|
4 | - */ |
|
3 | + * check core purge command |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Tests\Command; |
7 | 7 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * check import command |
|
4 | - */ |
|
3 | + * check import command |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | namespace Graviton\ImportExport\Tests\Command; |
7 | 7 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ->method('then') |
53 | 53 | ->will( |
54 | 54 | $this->returnCallback( |
55 | - function ($ok) use ($responseMock) { |
|
55 | + function($ok) use ($responseMock) { |
|
56 | 56 | $ok($responseMock); |
57 | 57 | } |
58 | 58 | ) |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ->method('then') |
134 | 134 | ->will( |
135 | 135 | $this->returnCallback( |
136 | - function ($ok, $nok) use ($exceptionMock) { |
|
136 | + function($ok, $nok) use ($exceptionMock) { |
|
137 | 137 | return $nok($exceptionMock); |
138 | 138 | } |
139 | 139 | ) |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ->method('then') |
216 | 216 | ->will( |
217 | 217 | $this->returnCallback( |
218 | - function ($ok) use ($responseMock) { |
|
218 | + function($ok) use ($responseMock) { |
|
219 | 219 | $ok($responseMock); |
220 | 220 | } |
221 | 221 | ) |