Passed
Push — master ( 40feff...710ff4 )
by Michael
01:41
created
www/src/DembeloMain/Tests/Model/ReadpathTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
                 $this->assertEquals($textnodeMockId, $readpathDocument->getTextnodeId());
99 99
                 $this->assertEquals($userMockId, $readpathDocument->getUserId());
100 100
                 $this->assertInstanceOf(\MongoDate::class, $readpathDocument->getTimestamp());
101
-                $this->assertLessThanOrEqual(1, abs($readpathDocument->getTimestamp()->sec-time()));
101
+                $this->assertLessThanOrEqual(1, abs($readpathDocument->getTimestamp()->sec - time()));
102 102
             });
103 103
 
104 104
         $readpath = new Readpath($readpathRepositoryMock, $this->session);
Please login to merge, or discard this patch.
www/src/DembeloMain/Model/FavoriteManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public function setFavorite(Textnode $textnode, User $user = null): void
51 51
     {
52 52
         if (null === $user) {
53
-            $this->session->set('favorite_'.$textnode->getTopicId(), $textnode->getArbitraryId());
53
+            $this->session->set('favorite_' . $textnode->getTopicId(), $textnode->getArbitraryId());
54 54
 
55 55
             return;
56 56
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function getFavorite(Topic $topic, User $user = null): ?string
67 67
     {
68 68
         if (null === $user) {
69
-            return $this->session->get('favorite_'.$topic->getId());
69
+            return $this->session->get('favorite_' . $topic->getId());
70 70
         }
71 71
 
72 72
         return $user->getFavorite($topic->getId());
Please login to merge, or discard this patch.
www/src/DembeloMain/Model/FeatureToggle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,6 +70,6 @@
 block discarded – undo
70 70
 
71 71
     private function buildParameterName(string $featureKey): string
72 72
     {
73
-        return 'features.'.$featureKey;
73
+        return 'features.' . $featureKey;
74 74
     }
75 75
 }
Please login to merge, or discard this patch.
www/src/DembeloMain/Controller/DefaultController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $textnode = $this->textnodeRepository->getTextnodeToRead($topicId);
155 155
 
156 156
         if (null === $textnode) {
157
-            throw $this->createNotFoundException('No Textnode for Topic \''.$topicId.'\' found.');
157
+            throw $this->createNotFoundException('No Textnode for Topic \'' . $topicId . '\' found.');
158 158
         }
159 159
 
160 160
         $user = $this->getUser();
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $textnode = $this->textnodeRepository->findOneActiveByArbitraryId($textnodeArbitraryId);
187 187
 
188 188
         if (null === $textnode) {
189
-            throw $this->createNotFoundException('No Textnode with arbitrary ID \''.$textnodeArbitraryId.'\' found.');
189
+            throw $this->createNotFoundException('No Textnode with arbitrary ID \'' . $textnodeArbitraryId . '\' found.');
190 190
         }
191 191
 
192 192
         if ($textnode->isFinanceNode()) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         $textnode = $this->textnodeRepository->findOneActiveById($textnodeId);
311 311
 
312 312
         if (null === $textnode) {
313
-            throw $this->createNotFoundException('No Textnode with ID \''.$textnodeId.'\' found.');
313
+            throw $this->createNotFoundException('No Textnode with ID \'' . $textnodeId . '\' found.');
314 314
         }
315 315
 
316 316
         $hitch = $textnode->getHitch($hitchIndex);
Please login to merge, or discard this patch.
www/src/AdminBundle/Model/ImportTwine.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $fileHandler = fopen($filenameExtracted, "rb");
109 109
 
110 110
         if ($fileHandler === false) {
111
-            throw new Exception("Couldn't open file '".$this->importfile->getFilename()."'");
111
+            throw new Exception("Couldn't open file '" . $this->importfile->getFilename() . "'");
112 112
         }
113 113
 
114 114
         $this->xmlParser = xml_parser_create("UTF-8");
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
             throw new Exception('no filename available');
137 137
         }
138 138
 
139
-        $extractedFilename = $this->importfile->getFilename().'.extracted';
139
+        $extractedFilename = $this->importfile->getFilename() . '.extracted';
140 140
 
141 141
         $fileHandle = fopen($this->importfile->getFilename(), 'r');
142 142
         $extractedFileHandle = fopen($extractedFilename, 'w');
143 143
         if ($fileHandle === false) {
144
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
144
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
145 145
         }
146 146
         $writing = false;
147 147
         $matches = array();
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
         $peekData = fread($fileHandler, 1024);
175 175
 
176 176
         if ($peekData === false) {
177
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
177
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
178 178
         }
179 179
 
180 180
         $peekDataLength = strlen($peekData);
181 181
 
182 182
         if ($peekDataLength <= 0) {
183
-            throw new Exception("File '".$this->importfile->getFilename()."' seems to be empty.");
183
+            throw new Exception("File '" . $this->importfile->getFilename() . "' seems to be empty.");
184 184
         }
185 185
 
186 186
         for ($i = 0; $i < $peekDataLength; $i++) {
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
             }
194 194
 
195 195
             if ($peekDataLength - $i < $magicStringLength) {
196
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
196
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
197 197
             }
198 198
 
199 199
             if (substr($peekData, $i, $magicStringLength) !== $magicString) {
200
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
200
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
201 201
             }
202 202
 
203 203
             if (fseek($fileHandler, 0) !== 0) {
204
-                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '".$this->importfile->getFilename()."' was checked.");
204
+                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '" . $this->importfile->getFilename() . "' was checked.");
205 205
             }
206 206
 
207 207
             return true;
208 208
         }
209 209
 
210
-        throw new Exception("File '".$this->importfile->getFilename()."' doesn't seem to be a Twine archive file.");
210
+        throw new Exception("File '" . $this->importfile->getFilename() . "' doesn't seem to be a Twine archive file.");
211 211
     }
212 212
 
213 213
     private function setXmlHandler(): void
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             $errorCode = xml_get_error_code($this->xmlParser);
230 230
             $errorDescription = xml_error_string($errorCode);
231 231
 
232
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope head for the Twine archive was parsed.");
232
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope head for the Twine archive was parsed.");
233 233
         }
234 234
     }
235 235
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             $errorCode = xml_get_error_code($this->xmlParser);
240 240
             $errorDescription = xml_error_string($errorCode);
241 241
 
242
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope foot for the Twine archive was parsed.");
242
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope foot for the Twine archive was parsed.");
243 243
         }
244 244
     }
245 245
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $errorColumnNumber = xml_get_current_column_number($this->xmlParser);
263 263
                 $errorByteIndex = xml_get_current_byte_index($this->xmlParser);
264 264
 
265
-                throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while parsing the Twine archive file '".$this->importfile->getFilename()."' in line ".$errorRowNumber.", character ".$errorColumnNumber." (at byte index ".$errorByteIndex.").");
265
+                throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while parsing the Twine archive file '" . $this->importfile->getFilename() . "' in line " . $errorRowNumber . ", character " . $errorColumnNumber . " (at byte index " . $errorByteIndex . ").");
266 266
             }
267 267
         } while (feof($fileHandler) === false);
268 268
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     private function startElementStoryData(string $name, array $attrs)
282 282
     {
283 283
         if ($this->twineRelevant === true) {
284
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
284
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
285 285
         }
286 286
 
287 287
         if (isset($attrs['startnode']) !== true) {
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
         }
294 294
 
295 295
         if (isset($attrs['name']) !== true) {
296
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'name' attribute.");
296
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'name' attribute.");
297 297
         }
298 298
 
299 299
         $twineStory = explode("-->", $attrs['name'], 2);
300 300
 
301 301
         if (count($twineStory) !== 2) {
302
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which has an incomplete 'name' attribute. Twine stories must use the naming schema '?-->story name', where '?' is an existing Dembelo Topic Id. Instead, '".$attrs['name']."' was found.");
302
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which has an incomplete 'name' attribute. Twine stories must use the naming schema '?-->story name', where '?' is an existing Dembelo Topic Id. Instead, '" . $attrs['name'] . "' was found.");
303 303
         }
304 304
 
305 305
         $this->topicId = $twineStory[0];
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $topic = $this->topicRepository->find($this->topicId);
308 308
 
309 309
         if (null === $topic) {
310
-            throw new Exception("The Dembelo Topic with Id '".$this->topicId."', referenced by Twine story '".$attrs['name']."' in the Twine archive file '".$this->importfile->getFilename()."', doesn't exist.");
310
+            throw new Exception("The Dembelo Topic with Id '" . $this->topicId . "', referenced by Twine story '" . $attrs['name'] . "' in the Twine archive file '" . $this->importfile->getFilename() . "', doesn't exist.");
311 311
         }
312 312
 
313 313
         $this->twineStartnodeId = $attrs['startnode'];
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     private function getTwineId(string $tagString, string $textnodeTitle): string
319 319
     {
320 320
         if (empty($tagString) || !is_string($tagString)) {
321
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
321
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
322 322
         }
323 323
         $tagArray = explode(" ", $tagString);
324 324
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         }
332 332
 
333 333
         if ($twineId === false) {
334
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
334
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
335 335
         }
336 336
 
337 337
         return $twineId;
@@ -340,21 +340,21 @@  discard block
 block discarded – undo
340 340
     private function startElementPassageData(string $name, array $attrs)
341 341
     {
342 342
         if ($this->twineText !== false) {
343
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
343
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
344 344
         }
345 345
 
346 346
         if (isset($attrs['pid']) !== true) {
347
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'pid' attribute.");
347
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'pid' attribute.");
348 348
         }
349 349
 
350 350
         if (is_numeric($attrs['pid']) !== true) {
351
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which hasn't a numeric value in its 'pid' attribute ('".$attrs['pid']."' was found instead).");
351
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which hasn't a numeric value in its 'pid' attribute ('" . $attrs['pid'] . "' was found instead).");
352 352
         }
353 353
 
354 354
         $this->twineId = $this->getTwineId($attrs['tags'], $attrs['name']);
355 355
 
356 356
         if (array_key_exists($this->twineId, $this->textnodeMapping) === true) {
357
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which has a non unique 'id' tag [".$this->twineId."], in node '".$attrs['name']."'");
357
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which has a non unique 'id' tag [" . $this->twineId . "], in node '" . $attrs['name'] . "'");
358 358
         }
359 359
 
360 360
         $this->twineTextnodeName = $attrs['name'];
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                 $this->textnode->setAccess(true);
387 387
                 $this->accessSet = true;
388 388
             } else {
389
-                throw new Exception("There is more than one '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' with the startnode value '".$attrs['pid']."' in its 'pid' attribute.");
389
+                throw new Exception("There is more than one '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' with the startnode value '" . $attrs['pid'] . "' in its 'pid' attribute.");
390 390
             }
391 391
         } else {
392 392
             $this->textnode->setAccess(false);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     private function characterData($parser, string $data)
408 408
     {
409 409
         if ($this->twineRelevant === true && $this->twineText === true) {
410
-            $this->textnode->setText($this->textnode->getText().$data);
410
+            $this->textnode->setText($this->textnode->getText() . $data);
411 411
         }
412 412
     }
413 413
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         $twineName = array_search($dembeloId, $this->nodeNameMapping);
418 418
 
419 419
         if (null === $textnode) {
420
-            throw new Exception("The Dembelo Textnode with Id '".$dembeloId."' doesn't exist, but should by now.");
420
+            throw new Exception("The Dembelo Textnode with Id '" . $dembeloId . "' doesn't exist, but should by now.");
421 421
         }
422 422
 
423 423
         /** @todo The links should be exported as XML as well instead of a custom Twine inline format. */
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 $endPos = strpos($textnodeText, "]]", $startPos + strlen("[["));
433 433
 
434 434
                 if ($endPos === false) {
435
-                    throw new Exception("The Twine archive file '".$this->importfile->getFilename()."' has a textnode named '".$twineName."' which contains a malformed link that starts with '[[' but has no corresponding ']]'.");
435
+                    throw new Exception("The Twine archive file '" . $this->importfile->getFilename() . "' has a textnode named '" . $twineName . "' which contains a malformed link that starts with '[[' but has no corresponding ']]'.");
436 436
                 }
437 437
 
438 438
                 $content = substr($textnodeText, $startPos + strlen("[["), $endPos - ($startPos + strlen("[[")));
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 
456 456
                 if ($hitch !== null) {
457 457
                     if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) {
458
-                        throw new Exception("There is a textnode named '".$twineName."' in the Twine archive file which has more than ".Textnode::HITCHES_MAXIMUM_COUNT." links.");
458
+                        throw new Exception("There is a textnode named '" . $twineName . "' in the Twine archive file which has more than " . Textnode::HITCHES_MAXIMUM_COUNT . " links.");
459 459
                     }
460 460
 
461 461
                     if ($textnode->appendHitch($hitch) !== true) {
462
-                        throw new Exception("Failed to append hitch for the textnode named '".$twineName."' from the Twine archive file.");
462
+                        throw new Exception("Failed to append hitch for the textnode named '" . $twineName . "' from the Twine archive file.");
463 463
                     }
464 464
                 }
465 465
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $contentArray = explode(">:<", $content, 2);
494 494
 
495 495
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
496
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0].">:<".$contentArray[1]."]]'.");
496
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . ">:<" . $contentArray[1] . "]]'.");
497 497
         }
498 498
 
499 499
         $metadata = $textnode->getMetadata();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         }
504 504
 
505 505
         if (array_key_exists($contentArray[0], $metadata) === true) {
506
-            throw new Exception("There is a textnode in the Twine archive file which contains the metadata field '".$contentArray[0]."' twice or would overwrite the already existing value of that field.");
506
+            throw new Exception("There is a textnode in the Twine archive file which contains the metadata field '" . $contentArray[0] . "' twice or would overwrite the already existing value of that field.");
507 507
         }
508 508
 
509 509
         $metadata[$contentArray[0]] = $contentArray[1];
Please login to merge, or discard this patch.