Completed
Pull Request — master (#366)
by Michael
08:55 queued 03:34
created
www/src/AdminBundle/Controller/ImportController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $importfile = $this->importfileRepository->find($importfileId);
123 123
         try {
124 124
             if (null === $importfile) {
125
-                throw new \Exception('file with id ['.$importfileId.'] not found');
125
+                throw new \Exception('file with id [' . $importfileId . '] not found');
126 126
             }
127 127
             $returnValue = $this->importTwine->run($importfile);
128 128
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
             return new Response(\json_encode($output));
160 160
         }
161 161
 
162
-        $filename = md5(uniqid('', true).$file['name']);
162
+        $filename = md5(uniqid('', true) . $file['name']);
163 163
 
164
-        move_uploaded_file($file['tmp_name'], $this->configTwineDirectory.$filename);
164
+        move_uploaded_file($file['tmp_name'], $this->configTwineDirectory . $filename);
165 165
 
166 166
         $output['filename'] = $filename;
167 167
         $output['orgname'] = $file['name'];
Please login to merge, or discard this patch.
www/src/AdminBundle/Tests/Model/ImportTwineTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 
265 265
         self::$freadStack = [
266 266
             '<tw-storydata ',
267
-            '<tw-storydata name="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",
268
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
267
+            '<tw-storydata name="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",
268
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
269 269
             '<tw-passagedata pid="1" name="someNodeName" tags="Freigegeben ID:foobar" position="104,30">lorem impsum',
270 270
             'lorem impsum</tw-passagedata></tw-storydata>',
271 271
         ];
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 
306 306
         self::$freadStack = [
307 307
             '<tw-storydata ',
308
-            '<tw-storydata name="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",
309
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
308
+            '<tw-storydata name="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",
309
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
310 310
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
311 311
             'lorem ipsum</tw-passagedata></tw-storydata>',
312 312
         ];
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 
347 347
         self::$freadStack = [
348 348
             '<tw-storydata ',
349
-            '<tw-storydata name="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",
350
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
349
+            '<tw-storydata name="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",
350
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
351 351
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
352 352
             'lorem ipsum</tw-passagedata></tw-storydata>',
353 353
         ];
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 
423 423
         self::$freadStack = [
424 424
             '<tw-storydata ',
425
-            '<tw-storydata name="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",
426
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
425
+            '<tw-storydata name="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",
426
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
427 427
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum',
428 428
             'lorem ipsum</tw-passagedata></tw-storydata>',
429 429
         ];
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 
457 457
         self::$freadStack = [
458 458
             '<tw-storydata ',
459
-            '<tw-storydata name="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",
460
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
459
+            '<tw-storydata name="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",
460
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
461 461
             '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum',
462 462
             'lorem ipsum</tw-passagedata></tw-storydata>',
463 463
         ];
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 
491 491
         self::$freadStack = [
492 492
             '<tw-storydata ',
493
-            '<tw-storydata name="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",
494
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
493
+            '<tw-storydata name="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",
494
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
495 495
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
496 496
             'lorem ipsum</tw-passagedata></tw-storydata>',
497 497
         ];
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
 
526 526
         self::$freadStack = [
527 527
             '<tw-storydata ',
528
-            '<tw-storydata name="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",
529
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
528
+            '<tw-storydata name="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",
529
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
530 530
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
531 531
             'lorem ipsum</tw-passagedata></tw-storydata>',
532 532
         ];
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 
563 563
         self::$freadStack = [
564 564
             '<tw-storydata ',
565
-            '<tw-storydata name="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",
566
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
565
+            '<tw-storydata name="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",
566
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
567 567
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
568 568
             'lorem ipsum</tw-passagedata></tw-storydata>',
569 569
         ];
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
 
604 604
         self::$freadStack = [
605 605
             '<tw-storydata ',
606
-            '<tw-storydata name="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",
607
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
606
+            '<tw-storydata name="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",
607
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
608 608
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId" position="104,30">lorem ipsum',
609 609
             'lorem ipsum</tw-passagedata>',
610 610
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId" position="104,30">lorem ipsum',
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 
641 641
         self::$freadStack = [
642 642
             '<tw-storydata ',
643
-            '<tw-storydata name="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",
644
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
643
+            '<tw-storydata name="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",
644
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
645 645
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
646 646
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
647 647
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             ->method('save')
678 678
             ->willReturnCallback(function ($textnode) {
679 679
                 static $counter = 0;
680
-                $textnode->setId('someTextnode'.$counter++);
680
+                $textnode->setId('someTextnode' . $counter++);
681 681
             });
682 682
 
683 683
         $importTwine = new ImportTwine($textnodeRepository, $hitchParserMock);
@@ -698,8 +698,8 @@  discard block
 block discarded – undo
698 698
 
699 699
         self::$freadStack = [
700 700
             '<tw-storydata ',
701
-            '<tw-storydata name="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",
702
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
701
+            '<tw-storydata name="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",
702
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
703 703
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
704 704
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
705 705
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 
740 740
         self::$freadStack = [
741 741
             '<tw-storydata ',
742
-            '<tw-storydata name="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",
743
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
742
+            '<tw-storydata name="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",
743
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
744 744
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
745 745
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
746 746
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 
776 776
         self::$freadStack = [
777 777
             '<tw-storydata ',
778
-            '<tw-storydata name="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",
779
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
778
+            '<tw-storydata name="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",
779
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
780 780
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
781 781
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
782 782
             '<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/Command/ImportCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
         $this->prepare($input);
107 107
 
108 108
         if (file_exists($this->twineArchivePath) !== true) {
109
-            $this->output->writeln("<error>Parameter 'twine-archive-file': File '".$this->twineArchivePath."' doesn't exist.</error>");
109
+            $this->output->writeln("<error>Parameter 'twine-archive-file': File '" . $this->twineArchivePath . "' doesn't exist.</error>");
110 110
 
111 111
             return -1;
112 112
         }
113 113
 
114 114
         if (is_readable($this->twineArchivePath) !== true) {
115
-            $this->output->writeln("<error>Parameter 'twine-archive-file': File '".$this->twineArchivePath."' isn't readable.</error>");
115
+            $this->output->writeln("<error>Parameter 'twine-archive-file': File '" . $this->twineArchivePath . "' isn't readable.</error>");
116 116
 
117 117
             return -1;
118 118
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
             $this->dm->flush();
134 134
         } catch (\Exception $ex) {
135
-            $output->writeln('<error>'.$ex->getMessage().'</error>');
135
+            $output->writeln('<error>' . $ex->getMessage() . '</error>');
136 136
 
137 137
             $importTwine->parserFree();
138 138
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
          */
161 161
         $licensee = $repositoryLicensee->findOneByName($input->getOption('licensee-name'));
162 162
         if (null === $licensee) {
163
-            throw new \Exception("<error>A Licensee named '".$input->getOption('licensee-name')."' doesn't exist.</error>");
163
+            throw new \Exception("<error>A Licensee named '" . $input->getOption('licensee-name') . "' doesn't exist.</error>");
164 164
         }
165 165
 
166 166
         /**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $repositoryTopic = $this->mongo->getRepository('DembeloMain:Topic');
170 170
         $topic = $repositoryTopic->findOneByName($input->getOption('topic-name'));
171 171
         if (null === $topic) {
172
-            throw new \Exception("<error>A Topic named '".$input->getOption('topic-name')."' doesn't exist.</error>");
172
+            throw new \Exception("<error>A Topic named '" . $input->getOption('topic-name') . "' doesn't exist.</error>");
173 173
         }
174 174
         $this->topicId = $topic->getId();
175 175
 
Please login to merge, or discard this patch.
www/src/AdminBundle/Controller/DefaultController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                     //$value = $value === 'aktiv' ? 1 : 0;
84 84
                     $query->field($field)->equals((int) $value);
85 85
                 } else {
86
-                    $query->field($field)->equals(new \MongoRegex('/.*'.$value.'.*/i'));
86
+                    $query->field($field)->equals(new \MongoRegex('/.*' . $value . '.*/i'));
87 87
                 }
88 88
             }
89 89
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         /* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */
149 149
         $repository = $mongo->getRepository('DembeloMain:Licensee');
150 150
 
151
-        $licensees = $repository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10);
151
+        $licensees = $repository->findBy(array('name' => new \MongoRegex('/' . $searchString . '/')), null, 10);
152 152
 
153 153
         $output = array();
154 154
         /* @var $licensee \DembeloMain\Document\Licensee */
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $repository = $mongo->getRepository('DembeloMain:Topic');
180 180
 
181 181
         /* @var $topics \DembeloMain\Document\Topic[] */
182
-        $topics = $repository->findBy(array('name' => new \MongoRegex('/'.$searchString.'/')), null, 10);
182
+        $topics = $repository->findBy(array('name' => new \MongoRegex('/' . $searchString . '/')), null, 10);
183 183
 
184 184
         $output = [];
185 185
         foreach ($topics as $topic) {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $formtype = $params['formtype'];
237 237
 
238 238
         /* @var $repository AbstractRepository */
239
-        $repository = $this->get('app.model_repository_'.$formtype);
239
+        $repository = $this->get('app.model_repository_' . $formtype);
240 240
 
241 241
         if (isset($params['id']) && $params['id'] == 'new') {
242 242
             $className = $repository->getClassName();
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             } elseif ($param === 'imported' && $value === '') {
263 263
                 $value = null;
264 264
             }
265
-            $method = 'set'.ucfirst($param);
265
+            $method = 'set' . ucfirst($param);
266 266
             if (method_exists($item, $method)) {
267 267
                 $item->$method($value);
268 268
             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         if (null === $user) {
314 314
             return new Response(\json_encode(['error' => false]));
315 315
         }
316
-        $user->setActivationHash(sha1($user->getEmail().$user->getPassword().\time()));
316
+        $user->setActivationHash(sha1($user->getEmail() . $user->getPassword() . \time()));
317 317
 
318 318
         $dm->persist($user);
319 319
         $dm->flush();
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             $obj->access = $textnode->getAccess() ? 'ja' : 'nein';
360 360
             $obj->licensee = $licenseeIndex[$textnode->getLicenseeId()];
361 361
             $obj->importfile = isset($importfileIndex[$textnode->getImportfileId()]) ? $importfileIndex[$textnode->getImportfileId()] : 'unbekannt';
362
-            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200)."...";
362
+            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200) . "...";
363 363
             $obj->financenode = $textnode->isFinanceNode() ? 'ja' : 'nein';
364 364
             $obj->twineId = $textnode->getTwineId();
365 365
             $obj->metadata = $this->formatMetadata($textnode->getMetadata());
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
         }
384 384
 
385 385
         $directory = $this->container->getParameter('twine_directory');
386
-        $finalDirectory = $directory.$item->getLicenseeId().'/';
386
+        $finalDirectory = $directory . $item->getLicenseeId() . '/';
387 387
         if (!is_dir($finalDirectory)) {
388 388
             mkdir($finalDirectory);
389 389
         }
390
-        $finalName = $finalDirectory.$item->getId();
391
-        $file = $directory.$filename;
390
+        $finalName = $finalDirectory . $item->getId();
391
+        $file = $directory . $filename;
392 392
         rename($file, $finalName);
393 393
 
394 394
         $item->setOriginalname($orgname);
@@ -432,12 +432,12 @@  discard block
 block discarded – undo
432 432
             return;
433 433
         }
434 434
         $directory = $this->container->getParameter('topic_image_directory');
435
-        $finalDirectory = $directory.$item->getId().'/';
435
+        $finalDirectory = $directory . $item->getId() . '/';
436 436
         if (!is_dir($finalDirectory)) {
437 437
             mkdir($finalDirectory);
438 438
         }
439
-        $finalName = $finalDirectory.$orgname;
440
-        $file = $directory.$filename;
439
+        $finalName = $finalDirectory . $orgname;
440
+        $file = $directory . $filename;
441 441
         rename($file, $finalName);
442 442
         $item->setOriginalImageName($orgname);
443 443
         $item->setImageFilename($finalName);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     {
448 448
         $string = '';
449 449
         foreach ($metadata as $key => $value) {
450
-            $string .= $key.': '.$value."\n";
450
+            $string .= $key . ': ' . $value . "\n";
451 451
         }
452 452
 
453 453
         return $string;
Please login to merge, or discard this patch.
www/src/AdminBundle/Model/ImportTwine.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $fileHandler = fopen($filenameExtracted, "rb");
99 99
 
100 100
         if ($fileHandler === false) {
101
-            throw new Exception("Couldn't open file '".$this->importfile->getFilename()."'");
101
+            throw new Exception("Couldn't open file '" . $this->importfile->getFilename() . "'");
102 102
         }
103 103
 
104 104
         $this->xmlParser = xml_parser_create("UTF-8");
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
             throw new Exception('no filename available');
127 127
         }
128 128
 
129
-        $extractedFilename = $this->importfile->getFilename().'.extracted';
129
+        $extractedFilename = $this->importfile->getFilename() . '.extracted';
130 130
 
131 131
         $fileHandle = fopen($this->importfile->getFilename(), 'r');
132 132
         $extractedFileHandle = fopen($extractedFilename, 'w');
133 133
         if ($fileHandle === false) {
134
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
134
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
135 135
         }
136 136
         $writing = false;
137 137
         $matches = array();
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
         $peekData = fread($fileHandler, 1024);
165 165
 
166 166
         if ($peekData === false) {
167
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
167
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
168 168
         }
169 169
 
170 170
         $peekDataLength = strlen($peekData);
171 171
 
172 172
         if ($peekDataLength <= 0) {
173
-            throw new Exception("File '".$this->importfile->getFilename()."' seems to be empty.");
173
+            throw new Exception("File '" . $this->importfile->getFilename() . "' seems to be empty.");
174 174
         }
175 175
 
176 176
         for ($i = 0; $i < $peekDataLength; $i++) {
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
             }
184 184
 
185 185
             if ($peekDataLength - $i < $magicStringLength) {
186
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
186
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
187 187
             }
188 188
 
189 189
             if (substr($peekData, $i, $magicStringLength) !== $magicString) {
190
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
190
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
191 191
             }
192 192
 
193 193
             if (fseek($fileHandler, 0) !== 0) {
194
-                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '".$this->importfile->getFilename()."' was checked.");
194
+                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '" . $this->importfile->getFilename() . "' was checked.");
195 195
             }
196 196
 
197 197
             return true;
198 198
         }
199 199
 
200
-        throw new Exception("File '".$this->importfile->getFilename()."' doesn't seem to be a Twine archive file.");
200
+        throw new Exception("File '" . $this->importfile->getFilename() . "' doesn't seem to be a Twine archive file.");
201 201
     }
202 202
 
203 203
     private function setXmlHandler(): void
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             $errorCode = xml_get_error_code($this->xmlParser);
220 220
             $errorDescription = xml_error_string($errorCode);
221 221
 
222
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope head for the Twine archive was parsed.");
222
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope head for the Twine archive was parsed.");
223 223
         }
224 224
     }
225 225
 
@@ -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 foot for the Twine archive was parsed.");
232
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope foot for the Twine archive was parsed.");
233 233
         }
234 234
     }
235 235
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                 $errorColumnNumber = xml_get_current_column_number($this->xmlParser);
253 253
                 $errorByteIndex = xml_get_current_byte_index($this->xmlParser);
254 254
 
255
-                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.").");
255
+                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 . ").");
256 256
             }
257 257
         } while (feof($fileHandler) === false);
258 258
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     private function startElementStoryData(string $name, array $attrs)
272 272
     {
273 273
         if ($this->twineRelevant === true) {
274
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
274
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
275 275
         }
276 276
 
277 277
         if (isset($attrs['startnode']) !== true) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         }
284 284
 
285 285
         if (isset($attrs['name']) !== true) {
286
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'name' attribute.");
286
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'name' attribute.");
287 287
         }
288 288
 
289 289
         $this->twineStartnodeId = $attrs['startnode'];
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     private function getTwineId(string $tagString, string $textnodeTitle): string
295 295
     {
296 296
         if (empty($tagString) || !is_string($tagString)) {
297
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
297
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
298 298
         }
299 299
         $tagArray = explode(' ', $tagString);
300 300
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
 
309 309
         if ($twineId === false) {
310
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
310
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
311 311
         }
312 312
 
313 313
         return $twineId;
@@ -316,21 +316,21 @@  discard block
 block discarded – undo
316 316
     private function startElementPassageData(string $name, array $attrs)
317 317
     {
318 318
         if ($this->twineText !== false) {
319
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
319
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
320 320
         }
321 321
 
322 322
         if (isset($attrs['pid']) !== true) {
323
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'pid' attribute.");
323
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'pid' attribute.");
324 324
         }
325 325
 
326 326
         if (is_numeric($attrs['pid']) !== true) {
327
-            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).");
327
+            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).");
328 328
         }
329 329
 
330 330
         $this->twineId = $this->getTwineId($attrs['tags'], $attrs['name']);
331 331
 
332 332
         if (array_key_exists($this->twineId, $this->textnodeMapping) === true) {
333
-            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']."'");
333
+            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'] . "'");
334 334
         }
335 335
 
336 336
         $this->twineTextnodeName = $attrs['name'];
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                 $this->textnode->setAccess(true);
363 363
                 $this->accessSet = true;
364 364
             } else {
365
-                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.");
365
+                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.");
366 366
             }
367 367
         } else {
368 368
             $this->textnode->setAccess(false);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     private function characterData($parser, string $data)
384 384
     {
385 385
         if ($this->twineRelevant === true && $this->twineText === true) {
386
-            $this->textnode->setText($this->textnode->getText().$data);
386
+            $this->textnode->setText($this->textnode->getText() . $data);
387 387
         }
388 388
     }
389 389
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         $twineName = array_search($dembeloId, $this->nodeNameMapping);
394 394
 
395 395
         if (null === $textnode) {
396
-            throw new Exception("The Dembelo Textnode with Id '".$dembeloId."' doesn't exist, but should by now.");
396
+            throw new Exception("The Dembelo Textnode with Id '" . $dembeloId . "' doesn't exist, but should by now.");
397 397
         }
398 398
 
399 399
         /** @todo The links should be exported as XML as well instead of a custom Twine inline format. */
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 $endPos = strpos($textnodeText, "]]", $startPos + strlen("[["));
409 409
 
410 410
                 if ($endPos === false) {
411
-                    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 ']]'.");
411
+                    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 ']]'.");
412 412
                 }
413 413
 
414 414
                 $content = substr($textnodeText, $startPos + strlen("[["), $endPos - ($startPos + strlen("[[")));
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 
432 432
                 if ($hitch !== null) {
433 433
                     if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) {
434
-                        throw new Exception("There is a textnode named '".$twineName."' in the Twine archive file which has more than ".Textnode::HITCHES_MAXIMUM_COUNT." links.");
434
+                        throw new Exception("There is a textnode named '" . $twineName . "' in the Twine archive file which has more than " . Textnode::HITCHES_MAXIMUM_COUNT . " links.");
435 435
                     }
436 436
 
437 437
                     if ($textnode->appendHitch($hitch) !== true) {
438
-                        throw new Exception("Failed to append hitch for the textnode named '".$twineName."' from the Twine archive file.");
438
+                        throw new Exception("Failed to append hitch for the textnode named '" . $twineName . "' from the Twine archive file.");
439 439
                     }
440 440
                 }
441 441
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         $contentArray = explode(">:<", $content, 2);
470 470
 
471 471
         if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) {
472
-            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0].">:<".$contentArray[1]."]]'.");
472
+            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . ">:<" . $contentArray[1] . "]]'.");
473 473
         }
474 474
 
475 475
         $metadata = $textnode->getMetadata();
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         }
480 480
 
481 481
         if (array_key_exists($contentArray[0], $metadata) === true) {
482
-            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.");
482
+            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.");
483 483
         }
484 484
 
485 485
         $metadata[$contentArray[0]] = $contentArray[1];
Please login to merge, or discard this patch.
www/src/DembeloMain/Document/Importfile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
     /**
152 152
      * @param integer $imported
153 153
      */
154
-    public function setImported(?int $imported): void
154
+    public function setImported(?int $imported) : void
155 155
     {
156 156
         $this->imported = $imported;
157 157
     }
Please login to merge, or discard this patch.