Passed
Push — master ( aa3dc5...40feff )
by Michael
01:43
created
www/src/AdminBundle/Tests/Model/ImportTwineTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
         self::$freadStack = [
275 275
             '<tw-storydata ',
276
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
277
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
276
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
277
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
278 278
             '<tw-passagedata pid="1" name="someNodeName" tags="Freigegeben ID:foobar" position="104,30">lorem impsum',
279 279
             'lorem impsum</tw-passagedata></tw-storydata>',
280 280
         ];
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
         self::$freadStack = [
321 321
             '<tw-storydata ',
322
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
323
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
322
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
323
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
324 324
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
325 325
             'lorem ipsum</tw-passagedata></tw-storydata>',
326 326
         ];
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 
366 366
         self::$freadStack = [
367 367
             '<tw-storydata ',
368
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
369
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
368
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
369
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
370 370
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
371 371
             'lorem ipsum</tw-passagedata></tw-storydata>',
372 372
         ];
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 
449 449
         self::$freadStack = [
450 450
             '<tw-storydata ',
451
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
452
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
451
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
452
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
453 453
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum',
454 454
             'lorem ipsum</tw-passagedata></tw-storydata>',
455 455
         ];
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
 
488 488
         self::$freadStack = [
489 489
             '<tw-storydata ',
490
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
491
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
490
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
491
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
492 492
             '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum',
493 493
             'lorem ipsum</tw-passagedata></tw-storydata>',
494 494
         ];
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 
527 527
         self::$freadStack = [
528 528
             '<tw-storydata ',
529
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
530
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
529
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
530
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
531 531
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
532 532
             'lorem ipsum</tw-passagedata></tw-storydata>',
533 533
         ];
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 
567 567
         self::$freadStack = [
568 568
             '<tw-storydata ',
569
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
570
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
569
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
570
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
571 571
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
572 572
             'lorem ipsum</tw-passagedata></tw-storydata>',
573 573
         ];
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 
609 609
         self::$freadStack = [
610 610
             '<tw-storydata ',
611
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
612
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
611
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
612
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
613 613
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
614 614
             'lorem ipsum</tw-passagedata></tw-storydata>',
615 615
         ];
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 
655 655
         self::$freadStack = [
656 656
             '<tw-storydata ',
657
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
658
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
657
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
658
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
659 659
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId" position="104,30">lorem ipsum',
660 660
             'lorem ipsum</tw-passagedata>',
661 661
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId" position="104,30">lorem ipsum',
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
 
697 697
         self::$freadStack = [
698 698
             '<tw-storydata ',
699
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
700
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
699
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
700
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
701 701
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
702 702
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
703 703
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
             ->method('save')
738 738
             ->willReturnCallback(function ($textnode) {
739 739
                 static $counter = 0;
740
-                $textnode->setId('someTextnode'.$counter++);
740
+                $textnode->setId('someTextnode' . $counter++);
741 741
             });
742 742
 
743 743
         $importTwine = new ImportTwine($textnodeRepository, $topicRepository, $hitchParserMock);
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
 
757 757
         self::$freadStack = [
758 758
             '<tw-storydata ',
759
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
760
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
759
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
760
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
761 761
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
762 762
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
763 763
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 
803 803
         self::$freadStack = [
804 804
             '<tw-storydata ',
805
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
806
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
805
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
806
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
807 807
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
808 808
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
809 809
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 
844 844
         self::$freadStack = [
845 845
             '<tw-storydata ',
846
-            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n",
847
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
846
+            '<tw-storydata name="someTopicId-->someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>' . "\n",
847
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
848 848
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
849 849
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
850 850
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
Please login to merge, or discard this patch.
www/src/AdminBundle/Controller/DefaultController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     //$value = $value === 'aktiv' ? 1 : 0;
87 87
                     $query->field($field)->equals((int) $value);
88 88
                 } else {
89
-                    $query->field($field)->equals(new \MongoRegex('/.*'.$value.'.*/i'));
89
+                    $query->field($field)->equals(new \MongoRegex('/.*' . $value . '.*/i'));
90 90
                 }
91 91
             }
92 92
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         /* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */
152 152
         $repository = $mongo->getRepository('DembeloMain:Licensee');
153 153
 
154
-        $licensees = $repository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10);
154
+        $licensees = $repository->findBy(array('name' => new \MongoRegex('/' . $searchString . '/')), null, 10);
155 155
 
156 156
         $output = array();
157 157
         /* @var $licensee \DembeloMain\Document\Licensee */
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $formtype = $params['formtype'];
210 210
 
211 211
         /* @var $repository AbstractRepository */
212
-        $repository = $this->get('app.model_repository_'.$formtype);
212
+        $repository = $this->get('app.model_repository_' . $formtype);
213 213
 
214 214
         if (isset($params['id']) && $params['id'] == 'new') {
215 215
             $className = $repository->getClassName();
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             } elseif ($param === 'imported' && $value === '') {
236 236
                 $value = null;
237 237
             }
238
-            $method = 'set'.ucfirst($param);
238
+            $method = 'set' . ucfirst($param);
239 239
             if (method_exists($item, $method)) {
240 240
                 $item->$method($value);
241 241
             }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         if (null === $user) {
287 287
             return new Response(\json_encode(['error' => false]));
288 288
         }
289
-        $user->setActivationHash(sha1($user->getEmail().$user->getPassword().\time()));
289
+        $user->setActivationHash(sha1($user->getEmail() . $user->getPassword() . \time()));
290 290
 
291 291
         $dm->persist($user);
292 292
         $dm->flush();
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 
358 358
         $directory = $this->container->getParameter('twine_directory');
359 359
 
360
-        $filename = md5(uniqid().$file['name']);
360
+        $filename = md5(uniqid() . $file['name']);
361 361
 
362
-        move_uploaded_file($file["tmp_name"], $directory.$filename);
362
+        move_uploaded_file($file["tmp_name"], $directory . $filename);
363 363
 
364 364
         $output['filename'] = $filename;
365 365
         $output['orgname'] = $file['name'];
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             $obj->access = $textnode->getAccess() ? 'ja' : 'nein';
394 394
             $obj->licensee = $licenseeIndex[$textnode->getLicenseeId()];
395 395
             $obj->importfile = isset($importfileIndex[$textnode->getImportfileId()]) ? $importfileIndex[$textnode->getImportfileId()] : 'unbekannt';
396
-            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200)."...";
396
+            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200) . "...";
397 397
             $obj->financenode = $textnode->isFinanceNode() ? 'ja' : 'nein';
398 398
             $obj->twineId = $textnode->getTwineId();
399 399
             $obj->metadata = $this->formatMetadata($textnode->getMetadata());
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
         }
457 457
 
458 458
         $directory = $this->container->getParameter('twine_directory');
459
-        $finalDirectory = $directory.$item->getLicenseeId().'/';
459
+        $finalDirectory = $directory . $item->getLicenseeId() . '/';
460 460
         if (!is_dir($finalDirectory)) {
461 461
             mkdir($finalDirectory);
462 462
         }
463
-        $finalName = $finalDirectory.$item->getId();
464
-        $file = $directory.$filename;
463
+        $finalName = $finalDirectory . $item->getId();
464
+        $file = $directory . $filename;
465 465
         rename($file, $finalName);
466 466
 
467 467
         $item->setOriginalname($orgname);
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
             return;
506 506
         }
507 507
         $directory = $this->container->getParameter('topic_image_directory');
508
-        $finalDirectory = $directory.$item->getId().'/';
508
+        $finalDirectory = $directory . $item->getId() . '/';
509 509
         if (!is_dir($finalDirectory)) {
510 510
             mkdir($finalDirectory);
511 511
         }
512
-        $finalName = $finalDirectory.$orgname;
513
-        $file = $directory.$filename;
512
+        $finalName = $finalDirectory . $orgname;
513
+        $file = $directory . $filename;
514 514
         rename($file, $finalName);
515 515
         $item->setOriginalImageName($orgname);
516 516
         $item->setImageFilename($finalName);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     {
521 521
         $string = '';
522 522
         foreach ($metadata as $key => $value) {
523
-            $string .= $key.': '.$value."\n";
523
+            $string .= $key . ': ' . $value . "\n";
524 524
         }
525 525
 
526 526
         return $string;
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
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $fileHandler = fopen($filenameExtracted, "rb");
110 110
 
111 111
         if ($fileHandler === false) {
112
-            throw new Exception("Couldn't open file '".$this->importfile->getFilename()."'");
112
+            throw new Exception("Couldn't open file '" . $this->importfile->getFilename() . "'");
113 113
         }
114 114
 
115 115
         $this->xmlParser = xml_parser_create("UTF-8");
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
             throw new Exception('no filename available');
138 138
         }
139 139
 
140
-        $extractedFilename = $this->importfile->getFilename().'.extracted';
140
+        $extractedFilename = $this->importfile->getFilename() . '.extracted';
141 141
 
142 142
         $fileHandle = fopen($this->importfile->getFilename(), 'r');
143 143
         $extractedFileHandle = fopen($extractedFilename, 'w');
144 144
         if ($fileHandle === false) {
145
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
145
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
146 146
         }
147 147
         $writing = false;
148 148
         $matches = array();
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
         $peekData = fread($fileHandler, 1024);
176 176
 
177 177
         if ($peekData === false) {
178
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
178
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
179 179
         }
180 180
 
181 181
         $peekDataLength = strlen($peekData);
182 182
 
183 183
         if ($peekDataLength <= 0) {
184
-            throw new Exception("File '".$this->importfile->getFilename()."' seems to be empty.");
184
+            throw new Exception("File '" . $this->importfile->getFilename() . "' seems to be empty.");
185 185
         }
186 186
 
187 187
         for ($i = 0; $i < $peekDataLength; $i++) {
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
             }
195 195
 
196 196
             if ($peekDataLength - $i < $magicStringLength) {
197
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
197
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
198 198
             }
199 199
 
200 200
             if (substr($peekData, $i, $magicStringLength) !== $magicString) {
201
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
201
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
202 202
             }
203 203
 
204 204
             if (fseek($fileHandler, 0) !== 0) {
205
-                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '".$this->importfile->getFilename()."' was checked.");
205
+                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '" . $this->importfile->getFilename() . "' was checked.");
206 206
             }
207 207
 
208 208
             return true;
209 209
         }
210 210
 
211
-        throw new Exception("File '".$this->importfile->getFilename()."' doesn't seem to be a Twine archive file.");
211
+        throw new Exception("File '" . $this->importfile->getFilename() . "' doesn't seem to be a Twine archive file.");
212 212
     }
213 213
 
214 214
     private function setXmlHandler(): void
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             $errorCode = xml_get_error_code($this->xmlParser);
231 231
             $errorDescription = xml_error_string($errorCode);
232 232
 
233
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope head for the Twine archive was parsed.");
233
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope head for the Twine archive was parsed.");
234 234
         }
235 235
     }
236 236
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             $errorCode = xml_get_error_code($this->xmlParser);
241 241
             $errorDescription = xml_error_string($errorCode);
242 242
 
243
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope foot for the Twine archive was parsed.");
243
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope foot for the Twine archive was parsed.");
244 244
         }
245 245
     }
246 246
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 $errorColumnNumber = xml_get_current_column_number($this->xmlParser);
264 264
                 $errorByteIndex = xml_get_current_byte_index($this->xmlParser);
265 265
 
266
-                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
+                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 . ").");
267 267
             }
268 268
         } while (feof($fileHandler) === false);
269 269
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     private function startElementStoryData($name, array $attrs)
283 283
     {
284 284
         if ($this->twineRelevant === true) {
285
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
285
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
286 286
         }
287 287
 
288 288
         if (isset($attrs['startnode']) !== true) {
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
         }
295 295
 
296 296
         if (isset($attrs['name']) !== true) {
297
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'name' attribute.");
297
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'name' attribute.");
298 298
         }
299 299
 
300 300
         $twineStory = explode("-->", $attrs['name'], 2);
301 301
 
302 302
         if (count($twineStory) !== 2) {
303
-            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
+            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.");
304 304
         }
305 305
 
306 306
         $this->topicId = $twineStory[0];
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         $topic = $this->topicRepository->find($this->topicId);
309 309
 
310 310
         if (null === $topic) {
311
-            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
+            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.");
312 312
         }
313 313
 
314 314
         $this->twineStartnodeId = $attrs['startnode'];
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     private function getTwineId($tagString, $textnodeTitle)
320 320
     {
321 321
         if (empty($tagString) || !is_string($tagString)) {
322
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
322
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
323 323
         }
324 324
         $tagArray = explode(" ", $tagString);
325 325
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         if ($twineId === false) {
335
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
335
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
336 336
         }
337 337
 
338 338
         return $twineId;
@@ -341,21 +341,21 @@  discard block
 block discarded – undo
341 341
     private function startElementPassageData($name, $attrs)
342 342
     {
343 343
         if ($this->twineText !== false) {
344
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
344
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
345 345
         }
346 346
 
347 347
         if (isset($attrs['pid']) !== true) {
348
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'pid' attribute.");
348
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'pid' attribute.");
349 349
         }
350 350
 
351 351
         if (is_numeric($attrs['pid']) !== true) {
352
-            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
+            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).");
353 353
         }
354 354
 
355 355
         $this->twineId = $this->getTwineId($attrs['tags'], $attrs['name']);
356 356
 
357 357
         if (array_key_exists($this->twineId, $this->textnodeMapping) === true) {
358
-            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
+            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'] . "'");
359 359
         }
360 360
 
361 361
         $this->twineTextnodeName = $attrs['name'];
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 $this->textnode->setAccess(true);
388 388
                 $this->accessSet = true;
389 389
             } else {
390
-                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
+                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.");
391 391
             }
392 392
         } else {
393 393
             $this->textnode->setAccess(false);
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     private function characterData($parser, $data)
409 409
     {
410 410
         if ($this->twineRelevant === true && $this->twineText === true) {
411
-            $this->textnode->setText($this->textnode->getText().$data);
411
+            $this->textnode->setText($this->textnode->getText() . $data);
412 412
         }
413 413
     }
414 414
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         $twineName = array_search($dembeloId, $this->nodeNameMapping);
419 419
 
420 420
         if (null === $textnode) {
421
-            throw new Exception("The Dembelo Textnode with Id '".$dembeloId."' doesn't exist, but should by now.");
421
+            throw new Exception("The Dembelo Textnode with Id '" . $dembeloId . "' doesn't exist, but should by now.");
422 422
         }
423 423
 
424 424
         /** @todo The links should be exported as XML as well instead of a custom Twine inline format. */
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
                 $endPos = strpos($textnodeText, "]]", $startPos + strlen("[["));
434 434
 
435 435
                 if ($endPos === false) {
436
-                    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
+                    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 ']]'.");
437 437
                 }
438 438
 
439 439
                 $content = substr($textnodeText, $startPos + strlen("[["), $endPos - ($startPos + strlen("[[")));
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 
457 457
                 if ($hitch !== null) {
458 458
                     if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) {
459
-                        throw new Exception("There is a textnode named '".$twineName."' in the Twine archive file which has more than ".Textnode::HITCHES_MAXIMUM_COUNT." links.");
459
+                        throw new Exception("There is a textnode named '" . $twineName . "' in the Twine archive file which has more than " . Textnode::HITCHES_MAXIMUM_COUNT . " links.");
460 460
                     }
461 461
 
462 462
                     if ($textnode->appendHitch($hitch) !== true) {
463
-                        throw new Exception("Failed to append hitch for the textnode named '".$twineName."' from the Twine archive file.");
463
+                        throw new Exception("Failed to append hitch for the textnode named '" . $twineName . "' from the Twine archive file.");
464 464
                     }
465 465
                 }
466 466
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
         $contentArray = explode(">:<", $content, 2);
495 495
 
496 496
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
497
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0].">:<".$contentArray[1]."]]'.");
497
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . ">:<" . $contentArray[1] . "]]'.");
498 498
         }
499 499
 
500 500
         $metadata = $textnode->getMetadata();
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         }
505 505
 
506 506
         if (array_key_exists($contentArray[0], $metadata) === true) {
507
-            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
+            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.");
508 508
         }
509 509
 
510 510
         $metadata[$contentArray[0]] = $contentArray[1];
Please login to merge, or discard this patch.
www/src/AdminBundle/Service/TwineImport/HitchParser.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
         $contentArray = explode("-->", $content, 2);
52 52
 
53 53
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
54
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."-->".$contentArray[1]."]]'.");
54
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "-->" . $contentArray[1] . "]]'.");
55 55
         }
56 56
 
57 57
         $externalTextnode = $this->textnodeRepository->find($contentArray[1]);
58 58
 
59 59
         if (null === $externalTextnode) {
60
-            throw new Exception("There is a textnode named '".$twineName."' which references the external Dembelo Textnode '".$contentArray[1]."', but a Dembelo Textnode with such an Id doesn't exist.");
60
+            throw new Exception("There is a textnode named '" . $twineName . "' which references the external Dembelo Textnode '" . $contentArray[1] . "', but a Dembelo Textnode with such an Id doesn't exist.");
61 61
         }
62 62
 
63 63
         $hitch = array();
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         $contentArray = explode("->", $content, 2);
74 74
 
75 75
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
76
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."->".$contentArray[1]."]]'.");
76
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "->" . $contentArray[1] . "]]'.");
77 77
         }
78 78
 
79 79
         if (array_key_exists($contentArray[1], $this->nodeNameMapping) !== true) {
80
-            throw new Exception("There is a textnode which references another textnode named '".$contentArray[1]."', but this textnode doesn't exist within the same story.");
80
+            throw new Exception("There is a textnode which references another textnode named '" . $contentArray[1] . "', but this textnode doesn't exist within the same story.");
81 81
         }
82 82
 
83 83
         $hitch = array();
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
         $contentArray = explode("<-", $content, 2);
94 94
 
95 95
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
96
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."<-".$contentArray[1]."]]'.");
96
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "<-" . $contentArray[1] . "]]'.");
97 97
         }
98 98
 
99 99
         if (array_key_exists($contentArray[0], $this->nodeNameMapping) !== true) {
100
-            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '".$contentArray[0]."', but this textnode doesn't exist within the same story.");
100
+            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '" . $contentArray[0] . "', but this textnode doesn't exist within the same story.");
101 101
         }
102 102
 
103 103
         $hitch = array();
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
     public function parseSimpleHitch(string $content, string $name): array
112 112
     {
113 113
         if (strlen($content) <= 0) {
114
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content."]]'.");
114
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content . "]]'.");
115 115
         }
116 116
 
117 117
         if (array_key_exists($content, $this->nodeNameMapping) !== true) {
118
-            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '".$content."', but this textnode doesn't exist within the same story.");
118
+            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '" . $content . "', but this textnode doesn't exist within the same story.");
119 119
         }
120 120
 
121 121
         $hitch = array();
Please login to merge, or discard this patch.
www/src/DembeloMain/Model/Repository/Doctrine/ODM/TextNodeRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
      */
157 157
     private function createArbitraryId(Textnode $object): string
158 158
     {
159
-        $id = substr(md5(time().$object->getTwineId().substr($object->getText(), 0, 100)), 0, 15);
159
+        $id = substr(md5(time() . $object->getTwineId() . substr($object->getText(), 0, 100)), 0, 15);
160 160
         $exists = count($this->findBy(array('arbitraryId' => $id))) > 0;
161 161
 
162 162
         if ($exists) {
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
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function setFavorite(Textnode $textnode, User $user = null): void
52 52
     {
53 53
         if (null === $user) {
54
-            $this->session->set('favorite_'.$textnode->getTopicId(), $textnode->getArbitraryId());
54
+            $this->session->set('favorite_' . $textnode->getTopicId(), $textnode->getArbitraryId());
55 55
 
56 56
             return;
57 57
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getFavorite(Topic $topic, User $user = null): string
68 68
     {
69 69
         if (null === $user) {
70
-            return $this->session->get('favorite_'.$topic->getId());
70
+            return $this->session->get('favorite_' . $topic->getId());
71 71
         }
72 72
 
73 73
         return $user->getFavorite($topic->getId());
Please login to merge, or discard this patch.