Completed
Push — master ( c83d56...aa3dc5 )
by Michael
09:25
created
www/src/AdminBundle/Tests/Model/ImportTwineTest.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @param string $filename
33 33
  * @return bool
34 34
  */
35
-function fopen($filename)
35
+function fopen ($filename)
36 36
 {
37 37
     return strpos($filename, 'readable') !== false;
38 38
 }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return bool|mixed
44 44
  */
45
-function fgets()
45
+function fgets ()
46 46
 {
47 47
     if (empty(ImportTwineTest::$fgetsStack)) {
48 48
         return false;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  * @param Resource $handle
58 58
  * @param string   $string
59 59
  */
60
-function fputs($handle, $string)
60
+function fputs ($handle, $string)
61 61
 {
62 62
     ImportTwineTest::$fputsStack[] = $string;
63 63
 }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 /**
66 66
  * mock function
67 67
  */
68
-function fclose()
68
+function fclose ()
69 69
 {
70 70
 }
71 71
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  *
75 75
  * @return bool|mixed
76 76
  */
77
-function fread()
77
+function fread ()
78 78
 {
79 79
     if (empty(ImportTwineTest::$freadStack)) {
80 80
         return false;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool
90 90
  */
91
-function feof()
91
+function feof ()
92 92
 {
93 93
     return empty(ImportTwineTest::$freadStack);
94 94
 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  *
99 99
  * @return int
100 100
  */
101
-function fseek()
101
+function fseek ()
102 102
 {
103 103
     return 0;
104 104
 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 /**
107 107
  * @param Resource $parser
108 108
  */
109
-function xml_parser_free($parser)
109
+function xml_parser_free ($parser)
110 110
 {
111 111
     ImportTwineTest::$parserFreeCalled = true;
112 112
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     /**
143 143
      * resets some variables
144 144
      */
145
-    public function setUp()
145
+    public function setUp ()
146 146
     {
147 147
         self::$freadStack = self::$fgetsStack = self::$fputsStack = [];
148 148
         $this->mocks = [];
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @expectedException Exception
154 154
      * @expectedExceptionMessage Failed to read data from file 'somefilename'
155 155
      */
156
-    public function testRunWithFopenIsFalse()
156
+    public function testRunWithFopenIsFalse ()
157 157
     {
158 158
         $textnodeRepository = $this->getTextnodeRepositoryMock();
159 159
         $topicRepository = $this->getTopicRepositoryMock();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      * @expectedException Exception
169 169
      * @expectedExceptionMessage Failed to read data from file 'somefilename_readable'
170 170
      */
171
-    public function testRunWithFreadReturnFalse()
171
+    public function testRunWithFreadReturnFalse ()
172 172
     {
173 173
         $textnodeRepository = $this->getTextnodeRepositoryMock();
174 174
         $topicRepository = $this->getTopicRepositoryMock();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      * @expectedException Exception
188 188
      * @expectedExceptionMessage File 'somefilename_readable' isn't a Twine archive file
189 189
      */
190
-    public function testRunWithWrongFileFormat()
190
+    public function testRunWithWrongFileFormat ()
191 191
     {
192 192
         $textnodeRepository = $this->getTextnodeRepositoryMock();
193 193
         $topicRepository = $this->getTopicRepositoryMock();
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      * @expectedException Exception
210 210
      * @expectedExceptionMessage File 'somefilename_readable' seems to be empty.
211 211
      */
212
-    public function testRunWithEmptyFirstLine()
212
+    public function testRunWithEmptyFirstLine ()
213 213
     {
214 214
         $textnodeRepository = $this->getTextnodeRepositoryMock();
215 215
         $topicRepository = $this->getTopicRepositoryMock();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      *
233 233
      * @throws \Exception
234 234
      */
235
-    public function testRunWithCorrectButIncompleteData()
235
+    public function testRunWithCorrectButIncompleteData ()
236 236
     {
237 237
         $textnodeRepository = $this->getTextnodeRepositoryMock();
238 238
         $topicRepository = $this->getTopicRepositoryMock();
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @throws \Exception
258 258
      */
259
-    public function testRunButNoTextnodeIsWritten()
259
+    public function testRunButNoTextnodeIsWritten ()
260 260
     {
261 261
         $textnodeRepository = $this->getTextnodeRepositoryMock();
262 262
         $topicRepository = $this->getTopicRepositoryMock();
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 
266 266
         self::$freadStack = [
267 267
             '<tw-storydata ',
268
-            '<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",
269
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
268
+            '<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",
269
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
270 270
             '<tw-passagedata pid="1" name="someNodeName" tags="Freigegeben ID:foobar" position="104,30">lorem impsum',
271 271
             'lorem impsum</tw-passagedata></tw-storydata>',
272 272
         ];
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      *
302 302
      * @throws \Exception
303 303
      */
304
-    public function testRunWithSingleNodeWithText()
304
+    public function testRunWithSingleNodeWithText ()
305 305
     {
306 306
         $textnodeRepository = $this->getTextnodeRepositoryMock();
307 307
         $topicRepository = $this->getTopicRepositoryMock();
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 
311 311
         self::$freadStack = [
312 312
             '<tw-storydata ',
313
-            '<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",
314
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
313
+            '<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",
314
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
315 315
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
316 316
             'lorem ipsum</tw-passagedata></tw-storydata>',
317 317
         ];
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
         $textnodeRepository->expects($this->once())
332 332
             ->method('save')
333
-            ->with($this->callback(function ($textnode) {
333
+            ->with($this->callback(function($textnode) {
334 334
                 return $textnode instanceof Textnode
335 335
                     && $textnode->getText() === "lorem ipsumlorem ipsum";
336 336
             }));
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      * @expectedException Exception
347 347
      * @expectedExceptionMessage The Twine archive file 'somefilename_readable' has a textnode named 'someNodeName1' which contains a malformed link that starts with '[[' but has no corresponding ']]'.
348 348
      */
349
-    public function testRunWithUnfinishedLinkTag()
349
+    public function testRunWithUnfinishedLinkTag ()
350 350
     {
351 351
         $textnodeRepository = $this->getTextnodeRepositoryMock();
352 352
         $topicRepository = $this->getTopicRepositoryMock();
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 
356 356
         self::$freadStack = [
357 357
             '<tw-storydata ',
358
-            '<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",
359
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
358
+            '<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",
359
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
360 360
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
361 361
             'lorem ipsum</tw-passagedata></tw-storydata>',
362 362
         ];
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
         $textnodeRepository->expects($this->any())
378 378
             ->method('save')
379
-            ->with($this->callback(function ($textnode) {
379
+            ->with($this->callback(function($textnode) {
380 380
                 return $textnode instanceof Textnode
381 381
                 && $textnode->getText() === "lorem ipsumlorem ipsum";
382 382
             }));
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      * @expectedException Exception
395 395
      * @expectedExceptionMessage no licensee available
396 396
      */
397
-    public function testRunWithExceptionWhenNoLicenseeIsAvailable()
397
+    public function testRunWithExceptionWhenNoLicenseeIsAvailable ()
398 398
     {
399 399
         $textnodeRepository = $this->getTextnodeRepositoryMock();
400 400
         $topicRepository = $this->getTopicRepositoryMock();
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      * @expectedException Exception
412 412
      * @expectedExceptionMessage no filename available
413 413
      */
414
-    public function testRunWithExceptionWhenNoFilenameIsAvailable()
414
+    public function testRunWithExceptionWhenNoFilenameIsAvailable ()
415 415
     {
416 416
         $textnodeRepository = $this->getTextnodeRepositoryMock();
417 417
         $topicRepository = $this->getTopicRepositoryMock();
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @expectedException Exception
427 427
      * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
428 428
      */
429
-    public function testRunWithTextnodeWithoutTwineID()
429
+    public function testRunWithTextnodeWithoutTwineID ()
430 430
     {
431 431
         $textnodeRepository = $this->getTextnodeRepositoryMock();
432 432
         $topicRepository = $this->getTopicRepositoryMock();
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 
436 436
         self::$freadStack = [
437 437
             '<tw-storydata ',
438
-            '<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",
439
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
438
+            '<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",
439
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
440 440
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum',
441 441
             'lorem ipsum</tw-passagedata></tw-storydata>',
442 442
         ];
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
      * @expectedException Exception
465 465
      * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
466 466
      */
467
-    public function testRunWithTextnodeWithoutAnyTag()
467
+    public function testRunWithTextnodeWithoutAnyTag ()
468 468
     {
469 469
         $textnodeRepository = $this->getTextnodeRepositoryMock();
470 470
         $topicRepository = $this->getTopicRepositoryMock();
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 
474 474
         self::$freadStack = [
475 475
             '<tw-storydata ',
476
-            '<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",
477
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
476
+            '<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",
477
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
478 478
             '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum',
479 479
             'lorem ipsum</tw-passagedata></tw-storydata>',
480 480
         ];
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      * tests identifying a textnode by a twine ID
503 503
      * @throws \Exception
504 504
      */
505
-    public function testRunWithTextnodeWithTwineID()
505
+    public function testRunWithTextnodeWithTwineID ()
506 506
     {
507 507
         $textnodeRepository = $this->getTextnodeRepositoryMock();
508 508
         $topicRepository = $this->getTopicRepositoryMock();
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 
512 512
         self::$freadStack = [
513 513
             '<tw-storydata ',
514
-            '<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",
515
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
514
+            '<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",
515
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
516 516
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
517 517
             'lorem ipsum</tw-passagedata></tw-storydata>',
518 518
         ];
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
      * tests the freeing of xml parser
542 542
      * @throws \Exception
543 543
      */
544
-    public function testParserFree()
544
+    public function testParserFree ()
545 545
     {
546 546
         $textnodeRepository = $this->getTextnodeRepositoryMock();
547 547
         $topicRepository = $this->getTopicRepositoryMock();
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
 
551 551
         self::$freadStack = [
552 552
             '<tw-storydata ',
553
-            '<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",
554
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
553
+            '<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",
554
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
555 555
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
556 556
             'lorem ipsum</tw-passagedata></tw-storydata>',
557 557
         ];
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
      * tests disabling of a textnode that is no longer found in import file
583 583
      * @throws \Exception
584 584
      */
585
-    public function testRunWithTextnodeDeletedInImportfile()
585
+    public function testRunWithTextnodeDeletedInImportfile ()
586 586
     {
587 587
         $textnodeRepository = $this->getTextnodeRepositoryMock();
588 588
         $topicRepository = $this->getTopicRepositoryMock();
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 
592 592
         self::$freadStack = [
593 593
             '<tw-storydata ',
594
-            '<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",
595
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
594
+            '<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",
595
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
596 596
             '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum',
597 597
             'lorem ipsum</tw-passagedata></tw-storydata>',
598 598
         ];
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
      * @expectedException Exception
628 628
      * @expectedExceptionMessage There is a 'tw-passagedata' in the Twine archive file 'somefilename_readable' which has a non unique 'id' tag [someTwineId], in node 'someNodeName2'
629 629
      */
630
-    public function testRunWithDuplicateTwineId()
630
+    public function testRunWithDuplicateTwineId ()
631 631
     {
632 632
         $textnodeRepository = $this->getTextnodeRepositoryMock();
633 633
         $topicRepository = $this->getTopicRepositoryMock();
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 
637 637
         self::$freadStack = [
638 638
             '<tw-storydata ',
639
-            '<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",
640
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
639
+            '<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",
640
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
641 641
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId" position="104,30">lorem ipsum',
642 642
             'lorem ipsum</tw-passagedata>',
643 643
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId" position="104,30">lorem ipsum',
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
      * @expectedException Exception
669 669
      * @expectedExceptionMessage There is a textnode which references another textnode named 'someNodeName3', but this textnode doesn't exist within the same story.
670 670
      */
671
-    public function testRunWithLinkToNonExistingTextnode()
671
+    public function testRunWithLinkToNonExistingTextnode ()
672 672
     {
673 673
         $textnodeRepository = $this->getTextnodeRepositoryMock();
674 674
         $topicRepository = $this->getTopicRepositoryMock();
@@ -677,8 +677,8 @@  discard block
 block discarded – undo
677 677
 
678 678
         self::$freadStack = [
679 679
             '<tw-storydata ',
680
-            '<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",
681
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
680
+            '<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",
681
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
682 682
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
683 683
             'lorem ipsum [[Linkdata->someNodeName3]]</tw-passagedata>',
684 684
             '</tw-storydata>',
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
      * tests a hitch to another textnode
709 709
      * @throws \Exception
710 710
      */
711
-    public function testRunWithLinkToAnotherTextnode()
711
+    public function testRunWithLinkToAnotherTextnode ()
712 712
     {
713 713
         $textnodeRepository = $this->getTextnodeRepositoryMock();
714 714
         $topicRepository = $this->getTopicRepositoryMock();
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 
718 718
         self::$freadStack = [
719 719
             '<tw-storydata ',
720
-            '<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",
721
-            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
720
+            '<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",
721
+            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n",
722 722
             '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum',
723 723
             'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>',
724 724
             '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum',
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
 
746 746
         $textnodeRepository->expects($this->any())
747 747
             ->method('save')
748
-            ->willReturnCallback(function ($textnode) {
748
+            ->willReturnCallback(function($textnode) {
749 749
                 static $counter = 0;
750
-                $textnode->setId('someTextnode'.$counter++);
750
+                $textnode->setId('someTextnode' . $counter++);
751 751
             });
752 752
 
753 753
         $importTwine = new ImportTwine($textnodeRepository, $topicRepository);
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
         $this->assertTrue($returnValue);
757 757
     }
758 758
 
759
-    private function getDummyImportfile(array $data = [])
759
+    private function getDummyImportfile (array $data = [])
760 760
     {
761 761
         $default = [
762 762
             'filename'   => 'somefilename_readable',
@@ -789,17 +789,17 @@  discard block
 block discarded – undo
789 789
         return $importfile;
790 790
     }
791 791
 
792
-    private function getTextnodeRepositoryMock()
792
+    private function getTextnodeRepositoryMock ()
793 793
     {
794 794
         return $this->getMockBuilder(TextNodeRepository::class)->disableOriginalConstructor()->setMethods(['createQueryBuilder', 'field', 'equals', 'getQuery', 'save', 'find', 'findByTwineId', 'disableOrphanedNodes', 'setHyphenatedText'])->getMock();
795 795
     }
796 796
 
797
-    private function getTopicRepositoryMock()
797
+    private function getTopicRepositoryMock ()
798 798
     {
799 799
         return $this->getMockBuilder(TopicRepository::class)->disableOriginalConstructor()->setMethods(['find'])->getMock();
800 800
     }
801 801
 
802
-    private function getDmMock()
802
+    private function getDmMock ()
803 803
     {
804 804
         return $this->getMockBuilder('dmMock')->setMethods(['flush', 'persist', 'find'])->getMock();
805 805
     }
Please login to merge, or discard this patch.
www/src/AdminBundle/Tests/Controller/DefaultControllerTest.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * tests the index action
58 58
      */
59
-    public function testIndexAction()
59
+    public function testIndexAction ()
60 60
     {
61 61
         $client = static::createClient();
62 62
         $crawler = $client->request('GET', '/admin/');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     /**
69 69
      * tests controller's userAction with no users in db
70 70
      */
71
-    public function testUserAction()
71
+    public function testUserAction ()
72 72
     {
73 73
         $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
74 74
         $postMock = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     /**
106 106
      * tests controller's userAction with two users in db
107 107
      */
108
-    public function testUserActionWithUsers()
108
+    public function testUserActionWithUsers ()
109 109
     {
110 110
         $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
111 111
         $postMock = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
         /* @var $response \Symfony\Component\HttpFoundation\Response */
153 153
         $response = $controller->usersAction($request);
154 154
         $this->assertInstanceOf(Response::class, $response);
155
-        $this->assertJsonStringEqualsJsonString('[{"id":"id1","gender":null,"email":"email1","roles":"ROLE_ADMIN","licenseeId":"lic1","status":null,"source":null,"reason":null,"created":"'.date('Y-m-d H:i:s', 0).'","updated":"'.date('Y-m-d H:i:s', 0).'"},{"id":"id2","email":"email2","roles":"ROLE_USER","licenseeId":"lic2","status":null,"source":null,"reason":null,"gender":null,"created":"'.date('Y-m-d H:i:s', 0).'","updated":"'.date('Y-m-d H:i:s', 0).'"}]', $response->getContent());
155
+        $this->assertJsonStringEqualsJsonString('[{"id":"id1","gender":null,"email":"email1","roles":"ROLE_ADMIN","licenseeId":"lic1","status":null,"source":null,"reason":null,"created":"' . date('Y-m-d H:i:s', 0) . '","updated":"' . date('Y-m-d H:i:s', 0) . '"},{"id":"id2","email":"email2","roles":"ROLE_USER","licenseeId":"lic2","status":null,"source":null,"reason":null,"gender":null,"created":"' . date('Y-m-d H:i:s', 0) . '","updated":"' . date('Y-m-d H:i:s', 0) . '"}]', $response->getContent());
156 156
         $this->assertEquals('200', $response->getStatusCode());
157 157
     }
158 158
 
159 159
     /**
160 160
      * tear down method
161 161
      */
162
-    public function tearDown()
162
+    public function tearDown ()
163 163
     {
164 164
         $this->container = null;
165 165
         $this->repository = null;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     /**
170 170
      * tests the formsaveAction without parameters
171 171
      */
172
-    public function testFormsaveActionWithoutParameters()
172
+    public function testFormsaveActionWithoutParameters ()
173 173
     {
174 174
         $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
175 175
         $postMock = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     /**
195 195
      * tests the formsaveAction with wrong parameters
196 196
      */
197
-    public function testFormsaveActionWithWrongParameters()
197
+    public function testFormsaveActionWithWrongParameters ()
198 198
     {
199 199
         $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
200 200
         $postMock = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     /**
222 222
      * tests the formsaveAction with an existing user
223 223
      */
224
-    public function testFormsaveActionExistingUser()
224
+    public function testFormsaveActionExistingUser ()
225 225
     {
226 226
         $user = new User();
227 227
         $user->setId('someId');
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     /**
262 262
      * tests the formsaveAction with a nonexisting user
263 263
      */
264
-    public function testFormsaveActionNotExistingUser()
264
+    public function testFormsaveActionNotExistingUser ()
265 265
     {
266 266
         $user = new User();
267 267
         $user->setId('someId');
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     /**
301 301
      * tests the formsaveAction without admin permission
302 302
      */
303
-    public function testFormsaveActionWithoutAdminPermission()
303
+    public function testFormsaveActionWithoutAdminPermission ()
304 304
     {
305 305
         $client = static::createClient();
306 306
         $crawler = $client->request('GET', '/admin/save');
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     /**
314 314
      * tests the formsaveAction with missing id parameter
315 315
      */
316
-    public function testFormsaveActionWithMissingIdParameter()
316
+    public function testFormsaveActionWithMissingIdParameter ()
317 317
     {
318 318
         $request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
319 319
         $postMock = $this->getMockBuilder(ParameterBag::class)->disableOriginalConstructor()->getMock();
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     /**
342 342
      * tests licenseeAction with no licensees
343 343
      */
344
-    public function testLicenseeActionWithNoLicensees()
344
+    public function testLicenseeActionWithNoLicensees ()
345 345
     {
346 346
         $repository = $this->getMockBuilder(LicenseeRepository::class)->disableOriginalConstructor()->setMethods(['findAll'])->getMock();
347 347
         $repository->expects($this->once())
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     /**
368 368
      * tests licenseeAction() with one licensee
369 369
      */
370
-    public function testLicenseeActionWithOneLicensee()
370
+    public function testLicenseeActionWithOneLicensee ()
371 371
     {
372 372
         $licensee = new Licensee();
373 373
         $licensee->setName('someName');
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     /**
398 398
      * tests textnode action
399 399
      */
400
-    public function testTextnodesAction()
400
+    public function testTextnodesAction ()
401 401
     {
402 402
         $textnode = new Textnode();
403 403
         $textnode->setId('someId');
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
         $this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
465 465
     }
466 466
 
467
-    private function getLicenseeRepositoryMock()
467
+    private function getLicenseeRepositoryMock ()
468 468
     {
469 469
         $repository = $this->getMockBuilder(LicenseeRepository::class)
470 470
             ->disableOriginalConstructor()
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         return $repository;
475 475
     }
476 476
 
477
-    private function getImportfileRepositoryMock()
477
+    private function getImportfileRepositoryMock ()
478 478
     {
479 479
         $repository = $this->getMockBuilder(ImportfileRepository::class)
480 480
             ->disableOriginalConstructor()
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     /**
488 488
      * load mockoed container and mocked mongodb repository
489 489
      */
490
-    private function loadMongoContainer($repository)
490
+    private function loadMongoContainer ($repository)
491 491
     {
492 492
         $this->loadMockedContainer();
493 493
         $this->loadMockedMongoRepository($repository);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     /**
497 497
      * load mocked container
498 498
      */
499
-    private function loadMockedContainer()
499
+    private function loadMockedContainer ()
500 500
     {
501 501
         $this->container = $this->createMock(ContainerInterface::class);
502 502
     }
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
     /**
505 505
      * load mocked mongodb repository
506 506
      */
507
-    private function loadMockedMongoRepository($repository)
507
+    private function loadMockedMongoRepository ($repository)
508 508
     {
509 509
         $this->service = $this->getMockBuilder(ManagerRegistry::class)->disableOriginalConstructor()->getMock();
510 510
         $this->repository = $this->getMockBuilder(DocumentRepository::class)->disableOriginalConstructor()->getMock();
511 511
         $this->container->expects($this->once())
512 512
             ->method("get")
513
-            ->with($this->equalTo('app.model_repository_'.$repository))
513
+            ->with($this->equalTo('app.model_repository_' . $repository))
514 514
             ->will($this->returnValue($this->repository));
515 515
     }
516 516
 }
Please login to merge, or discard this patch.
www/src/AdminBundle/Tests/Controller/TopicControllerTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * tests topicAction() with no topics
38 38
      */
39
-    public function testListActionWithNoTopics()
39
+    public function testListActionWithNoTopics ()
40 40
     {
41 41
         $container = $this->getMockBuilder(ContainerInterface::class)->getMock();
42 42
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * tests topicAction with one topic
64 64
      */
65
-    public function testListActionWithOneTopic()
65
+    public function testListActionWithOneTopic ()
66 66
     {
67 67
         $topic = new Topic();
68 68
         $topic->setName('someName');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     /**
96 96
      * tests topicAction with some filters
97 97
      */
98
-    public function testListActionWithSomeFilters()
98
+    public function testListActionWithSomeFilters ()
99 99
     {
100 100
         $topic = new Topic();
101 101
         $topic->setName('someName');
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     /**
137 137
      * tests uploadImageAction with an error in $_FILES
138 138
      */
139
-    public function testUploadImageActionWithNoFileError()
139
+    public function testUploadImageActionWithNoFileError ()
140 140
     {
141 141
         $repository = $this->getMockBuilder(TopicRepository::class)->disableOriginalConstructor()->setMethods(['findBy'])->getMock();
142 142
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     /**
161 161
      * tests uploadImageAction
162 162
      */
163
-    public function testUploadImageActionWithNoError()
163
+    public function testUploadImageActionWithNoError ()
164 164
     {
165 165
         $repository = $this->getMockBuilder(TopicRepository::class)->disableOriginalConstructor()->setMethods(['findBy'])->getMock();
166 166
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     /**
189 189
      * tear down method
190 190
      */
191
-    public function tearDown()
191
+    public function tearDown ()
192 192
     {
193 193
         $this->container = null;
194 194
         $this->repository = null;
Please login to merge, or discard this patch.
www/src/AdminBundle/Tests/Command/ImportCommandTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  * @param string $filename
30 30
  * @return bool
31 31
  */
32
-function is_readable($filename)
32
+function is_readable ($filename)
33 33
 {
34 34
     return \strpos($filename, 'readable') !== false;
35 35
 }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @param string $filename
39 39
  * @return bool
40 40
  */
41
-function file_exists($filename)
41
+function file_exists ($filename)
42 42
 {
43 43
     return \strpos($filename, 'exists') !== false;
44 44
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     private $command;
62 62
     private $commandTester;
63 63
 
64
-    protected function setUp()
64
+    protected function setUp ()
65 65
     {
66 66
         self::bootKernel();
67 67
         $application = new Application(self::$kernel);
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
     /**
76 76
      * tests the execute method
77 77
      */
78
-    public function testExecute()
78
+    public function testExecute ()
79 79
     {
80 80
         $this->mockObjects['importTwine']->expects($this->once())
81 81
             ->method('run')
82
-            ->will($this->returnCallback(function ($importfile) {
82
+            ->will($this->returnCallback(function($importfile) {
83 83
                 return $importfile->getFilename() === 'somefile_readable_exists.html'
84 84
                 && $importfile->getLicenseeId() === 'licenseeId'
85 85
                 && $importfile->getAuthor() === 'someauthor'
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * tests execute method with unreadable file
105 105
      */
106
-    public function testExecuteWithUnreadableFile()
106
+    public function testExecuteWithUnreadableFile ()
107 107
     {
108 108
         $this->mockObjects['importTwine']->expects($this->never())
109 109
             ->method('run');
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     /**
126 126
      * tests execute() method with non existing file
127 127
      */
128
-    public function testExecuteWithFileNotExisting()
128
+    public function testExecuteWithFileNotExisting ()
129 129
     {
130 130
         $this->mockObjects['importTwine']->expects($this->never())
131 131
             ->method('run');
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
     /**
148 148
      * tests execute() method with exception thrown by importTwine
149 149
      */
150
-    public function testExecuteWithExeptionInImportTwine()
150
+    public function testExecuteWithExeptionInImportTwine ()
151 151
     {
152 152
         $this->mockObjects['importTwine']->expects($this->once())
153 153
             ->method('run')
154
-            ->will($this->returnCallback(function ($importfile) {
154
+            ->will($this->returnCallback(function($importfile) {
155 155
                 return $importfile->getFilename() === 'somefile_readable_exists.html'
156 156
                 && $importfile->getLicenseeId() === 'licenseeId'
157 157
                 && $importfile->getAuthor() === 'someauthor'
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     /**
180 180
      * @expectedException Exception
181 181
      */
182
-    public function testExecuteWithLicenseeNotFound()
182
+    public function testExecuteWithLicenseeNotFound ()
183 183
     {
184 184
         $this->mockObjects['importTwine']->expects($this->never())
185 185
             ->method('run');
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param string $arg
206 206
      * @return null|\PHPUnit_Framework_MockObject_MockObject
207 207
      */
208
-    public function findOneByNameCallback($arg)
208
+    public function findOneByNameCallback ($arg)
209 209
     {
210 210
         if ($arg === 'somelicensee') {
211 211
             $licenseeMock = $this->getMockBuilder('DembeloMain\Document\Licensee')->disableOriginalConstructor()->getMock();
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         return null;
220 220
     }
221 221
 
222
-    private function getMockObjects()
222
+    private function getMockObjects ()
223 223
     {
224 224
         $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
225 225
 
Please login to merge, or discard this patch.
www/src/AdminBundle/Model/ImportTwine.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param TextnodeRepositoryInterface $textnodeRepository
77 77
      * @param TopicRepositoryInterface    $topicRepository
78 78
      */
79
-    public function __construct(TextNodeRepositoryInterface $textnodeRepository, TopicRepositoryInterface $topicRepository)
79
+    public function __construct (TextNodeRepositoryInterface $textnodeRepository, TopicRepositoryInterface $topicRepository)
80 80
     {
81 81
         $this->textnodeRepository = $textnodeRepository;
82 82
         $this->topicRepository = $topicRepository;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @return bool
90 90
      * @throws Exception
91 91
      */
92
-    public function run(Importfile $importfile)
92
+    public function run (Importfile $importfile)
93 93
     {
94 94
         $this->importfile = $importfile;
95 95
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $fileHandler = fopen($filenameExtracted, "rb");
103 103
 
104 104
         if ($fileHandler === false) {
105
-            throw new Exception("Couldn't open file '".$this->importfile->getFilename()."'");
105
+            throw new Exception("Couldn't open file '" . $this->importfile->getFilename() . "'");
106 106
         }
107 107
 
108 108
         $this->xmlParser = xml_parser_create("UTF-8");
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
     /**
120 120
      * destroys the parser object
121 121
      */
122
-    public function parserFree()
122
+    public function parserFree ()
123 123
     {
124 124
         xml_parser_free($this->xmlParser);
125 125
     }
126 126
 
127
-    private function extractTwineFile()
127
+    private function extractTwineFile ()
128 128
     {
129 129
         if (is_null($this->importfile->getFilename())) {
130 130
             throw new Exception('no filename available');
131 131
         }
132 132
 
133
-        $extractedFile = $this->importfile->getFilename().'.extracted';
133
+        $extractedFile = $this->importfile->getFilename() . '.extracted';
134 134
 
135 135
         $fileHandle = fopen($this->importfile->getFilename(), 'r');
136 136
         $extractedFileHandle = fopen($extractedFile, 'w');
137 137
         if ($fileHandle === false) {
138
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
138
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
139 139
         }
140 140
         $writing = false;
141 141
         $matches = array();
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         return $extractedFile;
161 161
     }
162 162
 
163
-    private function checkTwineFile($fileHandler)
163
+    private function checkTwineFile ($fileHandler)
164 164
     {
165 165
         $magicString = "<tw-storydata ";
166 166
         $magicStringLength = strlen($magicString);
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
         $peekData = fread($fileHandler, 1024);
169 169
 
170 170
         if ($peekData === false) {
171
-            throw new Exception("Failed to read data from file '".$this->importfile->getFilename()."'.");
171
+            throw new Exception("Failed to read data from file '" . $this->importfile->getFilename() . "'.");
172 172
         }
173 173
 
174 174
         $peekDataLength = strlen($peekData);
175 175
 
176 176
         if ($peekDataLength <= 0) {
177
-            throw new Exception("File '".$this->importfile->getFilename()."' seems to be empty.");
177
+            throw new Exception("File '" . $this->importfile->getFilename() . "' seems to be empty.");
178 178
         }
179 179
 
180 180
         for ($i = 0; $i < $peekDataLength; $i++) {
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
             }
188 188
 
189 189
             if ($peekDataLength - $i < $magicStringLength) {
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 (substr($peekData, $i, $magicStringLength) !== $magicString) {
194
-                throw new Exception("File '".$this->importfile->getFilename()."' isn't a Twine archive file.");
194
+                throw new Exception("File '" . $this->importfile->getFilename() . "' isn't a Twine archive file.");
195 195
             }
196 196
 
197 197
             if (fseek($fileHandler, 0) !== 0) {
198
-                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '".$this->importfile->getFilename()."' was checked.");
198
+                throw new Exception("Couldn't reset reading position after the magic string in the Twine archive file '" . $this->importfile->getFilename() . "' was checked.");
199 199
             }
200 200
 
201 201
             return true;
202 202
         }
203 203
 
204
-        throw new Exception("File '".$this->importfile->getFilename()."' doesn't seem to be a Twine archive file.");
204
+        throw new Exception("File '" . $this->importfile->getFilename() . "' doesn't seem to be a Twine archive file.");
205 205
     }
206 206
 
207
-    private function initParser($fileHandler)
207
+    private function initParser ($fileHandler)
208 208
     {
209 209
         xml_parser_set_option($this->xmlParser, XML_OPTION_CASE_FOLDING, 0);
210 210
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $errorCode = xml_get_error_code($this->xmlParser);
222 222
             $errorDescription = xml_error_string($errorCode);
223 223
 
224
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope head for the Twine archive was parsed.");
224
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope head for the Twine archive was parsed.");
225 225
         }
226 226
 
227 227
         do {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 $errorColumnNumber = xml_get_current_column_number($this->xmlParser);
238 238
                 $errorByteIndex = xml_get_current_byte_index($this->xmlParser);
239 239
 
240
-                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.").");
240
+                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 . ").");
241 241
             }
242 242
         } while (feof($fileHandler) === false);
243 243
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             $errorCode = xml_get_error_code($this->xmlParser);
246 246
             $errorDescription = xml_error_string($errorCode);
247 247
 
248
-            throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope foot for the Twine archive was parsed.");
248
+            throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope foot for the Twine archive was parsed.");
249 249
         }
250 250
 
251 251
         $this->parserFree();
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
         return true;
259 259
     }
260 260
 
261
-    private function startElementStoryData($name, array $attrs)
261
+    private function startElementStoryData ($name, array $attrs)
262 262
     {
263 263
         if ($this->twineRelevant === true) {
264
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
264
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
265 265
         }
266 266
 
267 267
         if (isset($attrs['startnode']) !== true) {
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
         }
274 274
 
275 275
         if (isset($attrs['name']) !== true) {
276
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'name' attribute.");
276
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'name' attribute.");
277 277
         }
278 278
 
279 279
         $twineStory = explode("-->", $attrs['name'], 2);
280 280
 
281 281
         if (count($twineStory) !== 2) {
282
-            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.");
282
+            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.");
283 283
         }
284 284
 
285 285
         $this->topicId = $twineStory[0];
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         $topic = $this->topicRepository->find($this->topicId);
288 288
 
289 289
         if (is_null($topic)) {
290
-            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.");
290
+            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.");
291 291
         }
292 292
 
293 293
         $this->twineStartnodeId = $attrs['startnode'];
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
         $this->twineRelevant = true;
296 296
     }
297 297
 
298
-    private function getTwineId($tagString, $textnodeTitle)
298
+    private function getTwineId ($tagString, $textnodeTitle)
299 299
     {
300 300
         if (empty($tagString) || !is_string($tagString)) {
301
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
301
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
302 302
         }
303 303
         $tagArray = explode(" ", $tagString);
304 304
 
@@ -311,30 +311,30 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         if ($twineId === false) {
314
-            throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"');
314
+            throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"');
315 315
         }
316 316
 
317 317
         return $twineId;
318 318
     }
319 319
 
320
-    private function startElementPassageData($name, $attrs)
320
+    private function startElementPassageData ($name, $attrs)
321 321
     {
322 322
         if ($this->twineText !== false) {
323
-            throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'.");
323
+            throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'.");
324 324
         }
325 325
 
326 326
         if (isset($attrs['pid']) !== true) {
327
-            throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'pid' attribute.");
327
+            throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'pid' attribute.");
328 328
         }
329 329
 
330 330
         if (is_numeric($attrs['pid']) !== true) {
331
-            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).");
331
+            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).");
332 332
         }
333 333
 
334 334
         $this->twineId = $this->getTwineId($attrs['tags'], $attrs['name']);
335 335
 
336 336
         if (array_key_exists($this->twineId, $this->textnodeMapping) === true) {
337
-            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']."'");
337
+            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'] . "'");
338 338
         }
339 339
 
340 340
         $this->twineTextnodeName = $attrs['name'];
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 $this->textnode->setAccess(true);
367 367
                 $this->accessSet = true;
368 368
             } else {
369
-                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.");
369
+                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.");
370 370
             }
371 371
         } else {
372 372
             $this->textnode->setAccess(false);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         $this->twineText = true;
376 376
     }
377 377
 
378
-    private function startElement($parser, $name, $attrs)
378
+    private function startElement ($parser, $name, $attrs)
379 379
     {
380 380
         if ($name === "tw-storydata") {
381 381
             $this->startElementStoryData($name, $attrs);
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
         }
385 385
     }
386 386
 
387
-    private function characterData($parser, $data)
387
+    private function characterData ($parser, $data)
388 388
     {
389 389
         if ($this->twineRelevant === true && $this->twineText === true) {
390
-            $this->textnode->setText($this->textnode->getText().$data);
390
+            $this->textnode->setText($this->textnode->getText() . $data);
391 391
         }
392 392
     }
393 393
 
394
-    private function endElementStoryData($name)
394
+    private function endElementStoryData ($name)
395 395
     {
396 396
         foreach ($this->textnodeMapping as $twineId => $dembeloId) {
397 397
             $textnode = $this->textnodeRepository->find($dembeloId);
398 398
             $twineName = array_search($dembeloId, $this->nodeNameMapping);
399 399
 
400 400
             if (is_null($textnode) === true) {
401
-                throw new Exception("The Dembelo Textnode with Id '".$dembeloId."' doesn't exist, but should by now.");
401
+                throw new Exception("The Dembelo Textnode with Id '" . $dembeloId . "' doesn't exist, but should by now.");
402 402
             }
403 403
 
404 404
             /** @todo The links should be exported as XML as well instead of a custom Twine inline format. */
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                     $endPos = strpos($textnodeText, "]]", $startPos + strlen("[["));
414 414
 
415 415
                     if ($endPos === false) {
416
-                        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 ']]'.");
416
+                        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 ']]'.");
417 417
                     }
418 418
 
419 419
                     $content = substr($textnodeText, $startPos + strlen("[["), $endPos - ($startPos + strlen("[[")));
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
                         $content = explode("-->", $content, 2);
425 425
 
426 426
                         if (strlen($content[0]) <= 0 || strlen($content[1]) <= 0) {
427
-                            throw new Exception("The Twine archive file '".$this->importfile->getFilename()."' contains a '".$name."' with the invalid element '[[".$content[0]."-->".$content[1]."]]'.");
427
+                            throw new Exception("The Twine archive file '" . $this->importfile->getFilename() . "' contains a '" . $name . "' with the invalid element '[[" . $content[0] . "-->" . $content[1] . "]]'.");
428 428
                         }
429 429
 
430 430
                         $externalTextnode = $this->textnodeRepository->find($content[1]);
431 431
 
432 432
                         if (is_null($externalTextnode)) {
433
-                            throw new Exception("There is a textnode named '".$twineName."' which references the external Dembelo Textnode '".$content[1]."', but a Dembelo Textnode with such an Id doesn't exist.");
433
+                            throw new Exception("There is a textnode named '" . $twineName . "' which references the external Dembelo Textnode '" . $content[1] . "', but a Dembelo Textnode with such an Id doesn't exist.");
434 434
                         }
435 435
 
436 436
                         $hitch = array();
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
                         $content = explode("->", $content, 2);
442 442
 
443 443
                         if (strlen($content[0]) <= 0 || strlen($content[1]) <= 0) {
444
-                            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content[0]."->".$content[1]."]]'.");
444
+                            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content[0] . "->" . $content[1] . "]]'.");
445 445
                         }
446 446
 
447 447
                         if (array_key_exists($content[1], $this->nodeNameMapping) !== true) {
448
-                            throw new Exception("There is a textnode which references another textnode named '".$content[1]."', but this textnode doesn't exist within the same story.");
448
+                            throw new Exception("There is a textnode which references another textnode named '" . $content[1] . "', but this textnode doesn't exist within the same story.");
449 449
                         }
450 450
 
451 451
                         $hitch = array();
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
                         $content = explode("<-", $content, 2);
457 457
 
458 458
                         if (strlen($content[0]) <= 0 || strlen($content[1]) <= 0) {
459
-                            throw new Exception("The Twine archive file '".$this->importfile->getFilename()."' contains a '".$name."' with the invalid element '[[".$content[0]."<-".$content[1]."]]'.");
459
+                            throw new Exception("The Twine archive file '" . $this->importfile->getFilename() . "' contains a '" . $name . "' with the invalid element '[[" . $content[0] . "<-" . $content[1] . "]]'.");
460 460
                         }
461 461
 
462 462
                         if (array_key_exists($content[0], $this->nodeNameMapping) !== true) {
463 463
                             var_dump($this->nodeNameMapping);
464
-                            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '".$content[0]."', but this textnode doesn't exist within the same story.");
464
+                            throw new Exception("There is a textnode in the Twine archive file which references another textnode named '" . $content[0] . "', but this textnode doesn't exist within the same story.");
465 465
                         }
466 466
 
467 467
                         $hitch = array();
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                         $content = explode(">:<", $content, 2);
473 473
 
474 474
                         if (strlen($content[0]) <= 0 || strlen($content[1]) <= 0) {
475
-                            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content[0].">:<".$content[1]."]]'.");
475
+                            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content[0] . ">:<" . $content[1] . "]]'.");
476 476
                         }
477 477
 
478 478
                         $metadata = $textnode->getMetadata();
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
                         }
483 483
 
484 484
                         if (array_key_exists($content[0], $metadata) === true) {
485
-                            throw new Exception("There is a textnode in the Twine archive file which contains the metadata field '".$content[0]."' twice or would overwrite the already existing value of that field.");
485
+                            throw new Exception("There is a textnode in the Twine archive file which contains the metadata field '" . $content[0] . "' twice or would overwrite the already existing value of that field.");
486 486
                         }
487 487
 
488 488
                         $metadata[$content[0]] = $content[1];
489 489
                     } else {
490 490
                         if (strlen($content) <= 0) {
491
-                            throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content."]]'.");
491
+                            throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content . "]]'.");
492 492
                         }
493 493
 
494 494
                         if (array_key_exists($content, $this->nodeNameMapping) !== true) {
495
-                            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.");
495
+                            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.");
496 496
                         }
497 497
 
498 498
                         $hitch = array();
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
 
504 504
                     if ($hitch !== null) {
505 505
                         if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) {
506
-                            throw new Exception("There is a textnode named '".$twineName."' in the Twine archive file which has more than ".Textnode::HITCHES_MAXIMUM_COUNT." links.");
506
+                            throw new Exception("There is a textnode named '" . $twineName . "' in the Twine archive file which has more than " . Textnode::HITCHES_MAXIMUM_COUNT . " links.");
507 507
                         }
508 508
 
509 509
                         if ($textnode->appendHitch($hitch) !== true) {
510
-                            throw new Exception("Failed to append hitch for the textnode named '".$twineName."' from the Twine archive file.");
510
+                            throw new Exception("Failed to append hitch for the textnode named '" . $twineName . "' from the Twine archive file.");
511 511
                         }
512 512
                     }
513 513
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
         $this->accessSet = false;
562 562
     }
563 563
 
564
-    private function endElementPassageData()
564
+    private function endElementPassageData ()
565 565
     {
566 566
         $this->textnodeRepository->save($this->textnode);
567 567
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      * @param string $name
581 581
      * @throws Exception
582 582
      */
583
-    private function endElement($parser, $name)
583
+    private function endElement ($parser, $name)
584 584
     {
585 585
         if ($name === "tw-storydata") {
586 586
             $this->endElementStoryData($name);
Please login to merge, or discard this patch.
www/src/AdminBundle/Controller/TopicController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param ContainerInterface       $container
45 45
      * @param TopicRepositoryInterface $topicRepository
46 46
      */
47
-    public function __construct(ContainerInterface $container, TopicRepositoryInterface $topicRepository)
47
+    public function __construct (ContainerInterface $container, TopicRepositoryInterface $topicRepository)
48 48
     {
49 49
         $this->container = $container;
50 50
         $this->topicRepository = $topicRepository;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param Request $request
57 57
      * @return Response
58 58
      */
59
-    public function listAction(Request $request)
59
+    public function listAction (Request $request)
60 60
     {
61 61
         $filters = $request->query->get('filter');
62 62
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return Response
88 88
      */
89
-    public function uploadImageAction()
89
+    public function uploadImageAction ()
90 90
     {
91 91
         $output = array();
92 92
         $file = $_FILES['upload'];
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
             return new Response(\json_encode($output));
97 97
         }
98 98
         $directory = $this->getParameter('topic_image_directory');
99
-        $filename = md5(uniqid().$file['name']);
100
-        move_uploaded_file($file["tmp_name"], $directory.$filename);
99
+        $filename = md5(uniqid() . $file['name']);
100
+        move_uploaded_file($file["tmp_name"], $directory . $filename);
101 101
         $output['imageFileName'] = $filename;
102 102
         $output['originalImageName'] = $file['name'];
103 103
 
Please login to merge, or discard this patch.
www/src/AdminBundle/Controller/DefaultController.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return string
51 51
      */
52
-    public function indexAction()
52
+    public function indexAction ()
53 53
     {
54 54
         $mainMenuData = [
55 55
             ['id' => "1", 'type' => "folder", 'value' => "Benutzer", 'css' => "folder_music"],
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param Request $request
71 71
      * @return String
72 72
      */
73
-    public function usersAction(Request $request)
73
+    public function usersAction (Request $request)
74 74
     {
75 75
         $repository = $this->get('app.model_repository_user');
76 76
 
@@ -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
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @return String
119 119
      */
120
-    public function licenseesAction()
120
+    public function licenseesAction ()
121 121
     {
122 122
         $repository = $this->get('app.model_repository_licensee');
123 123
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @param Request $request
142 142
      * @return String
143 143
      */
144
-    public function licenseeSuggestAction(Request $request)
144
+    public function licenseeSuggestAction (Request $request)
145 145
     {
146 146
         $filter = $request->query->get('filter');
147 147
 
@@ -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 */
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      *
171 171
      * @return String
172 172
      */
173
-    public function topicsAction()
173
+    public function topicsAction ()
174 174
     {
175 175
         $mongo = $this->get('doctrine_mongodb');
176 176
         /* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param Request $request
197 197
      * @return String
198 198
      */
199
-    public function formsaveAction(Request $request)
199
+    public function formsaveAction (Request $request)
200 200
     {
201 201
         $params = $request->request->all();
202 202
 
@@ -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
             }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      * @param Request $request
271 271
      * @return String
272 272
      */
273
-    public function useractivationmailAction(Request $request)
273
+    public function useractivationmailAction (Request $request)
274 274
     {
275 275
         $userId = $request->request->get('userId');
276 276
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         /* @var $user \DembeloMain\Document\User */
285 285
         $user = $repository->find($userId);
286
-        $user->setActivationHash(sha1($user->getEmail().$user->getPassword().\time()));
286
+        $user->setActivationHash(sha1($user->getEmail() . $user->getPassword() . \time()));
287 287
 
288 288
         $dm->persist($user);
289 289
         $dm->flush();
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      *
312 312
      * @return Response
313 313
      */
314
-    public function importfilesAction()
314
+    public function importfilesAction ()
315 315
     {
316 316
         $mongo = $this->get('doctrine_mongodb');
317 317
         /* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      *
342 342
      * @return Response
343 343
      */
344
-    public function uploadImportfileAction()
344
+    public function uploadImportfileAction ()
345 345
     {
346 346
         $output = array();
347 347
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 
356 356
         $directory = $this->container->getParameter('twine_directory');
357 357
 
358
-        $filename = md5(uniqid().$file['name']);
358
+        $filename = md5(uniqid() . $file['name']);
359 359
 
360
-        move_uploaded_file($file["tmp_name"], $directory.$filename);
360
+        move_uploaded_file($file["tmp_name"], $directory . $filename);
361 361
 
362 362
         $output['filename'] = $filename;
363 363
         $output['orgname'] = $file['name'];
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
      *
373 373
      * @return Response
374 374
      */
375
-    public function textnodesAction()
375
+    public function textnodesAction ()
376 376
     {
377 377
         $repository = $this->get('app.model_repository_textNode');
378 378
         $textnodes = $repository->findAll();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             $obj->access = $textnode->getAccess() ? 'ja' : 'nein';
392 392
             $obj->licensee = $licenseeIndex[$textnode->getLicenseeId()];
393 393
             $obj->importfile = isset($importfileIndex[$textnode->getImportfileId()]) ? $importfileIndex[$textnode->getImportfileId()] : 'unbekannt';
394
-            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200)."...";
394
+            $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200) . "...";
395 395
             $obj->financenode = $textnode->isFinanceNode() ? 'ja' : 'nein';
396 396
             $obj->twineId = $textnode->getTwineId();
397 397
             $obj->metadata = $this->formatMetadata($textnode->getMetadata());
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      *
409 409
      * @return Response
410 410
      */
411
-    public function importAction(Request $request)
411
+    public function importAction (Request $request)
412 412
     {
413 413
         $importfileId = $request->get('importfileId');
414 414
 
@@ -447,26 +447,26 @@  discard block
 block discarded – undo
447 447
      * @param string $filename filename hash
448 448
      * @param string $orgname original name
449 449
      */
450
-    private function saveFile(Importfile $item, $filename, $orgname)
450
+    private function saveFile (Importfile $item, $filename, $orgname)
451 451
     {
452 452
         if (empty($filename) || empty($orgname)) {
453 453
             return;
454 454
         }
455 455
 
456 456
         $directory = $this->container->getParameter('twine_directory');
457
-        $finalDirectory = $directory.$item->getLicenseeId().'/';
457
+        $finalDirectory = $directory . $item->getLicenseeId() . '/';
458 458
         if (!is_dir($finalDirectory)) {
459 459
             mkdir($finalDirectory);
460 460
         }
461
-        $finalName = $finalDirectory.$item->getId();
462
-        $file = $directory.$filename;
461
+        $finalName = $finalDirectory . $item->getId();
462
+        $file = $directory . $filename;
463 463
         rename($file, $finalName);
464 464
 
465 465
         $item->setOriginalname($orgname);
466 466
         $item->setFilename($finalName);
467 467
     }
468 468
 
469
-    private function buildLicenseeIndex()
469
+    private function buildLicenseeIndex ()
470 470
     {
471 471
         $repository = $this->get('app.model_repository_licensee');
472 472
         $licensees = $repository->findAll();
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         return $index;
479 479
     }
480 480
 
481
-    private function buildImportfileIndex()
481
+    private function buildImportfileIndex ()
482 482
     {
483 483
         $repository = $this->get('app.model_repository_importfile');
484 484
         $importfiles = $repository->findAll();
@@ -497,28 +497,28 @@  discard block
 block discarded – undo
497 497
      * @param string $filename filename hash
498 498
      * @param string $orgname original name
499 499
      */
500
-    private function saveTopicImage(Topic $item, $filename, $orgname)
500
+    private function saveTopicImage (Topic $item, $filename, $orgname)
501 501
     {
502 502
         if (empty($filename) || empty($orgname)) {
503 503
             return;
504 504
         }
505 505
         $directory = $this->container->getParameter('topic_image_directory');
506
-        $finalDirectory = $directory.$item->getId().'/';
506
+        $finalDirectory = $directory . $item->getId() . '/';
507 507
         if (!is_dir($finalDirectory)) {
508 508
             mkdir($finalDirectory);
509 509
         }
510
-        $finalName = $finalDirectory.$orgname;
511
-        $file = $directory.$filename;
510
+        $finalName = $finalDirectory . $orgname;
511
+        $file = $directory . $filename;
512 512
         rename($file, $finalName);
513 513
         $item->setOriginalImageName($orgname);
514 514
         $item->setImageFilename($finalName);
515 515
     }
516 516
 
517
-    private function formatMetadata(array $metadata)
517
+    private function formatMetadata (array $metadata)
518 518
     {
519 519
         $string = '';
520 520
         foreach ($metadata as $key => $value) {
521
-            $string .= $key.': '.$value."\n";
521
+            $string .= $key . ': ' . $value . "\n";
522 522
         }
523 523
 
524 524
         return $string;
Please login to merge, or discard this patch.
www/src/AdminBundle/Command/ImportCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * configures the symfony cli command
63 63
      */
64
-    protected function configure()
64
+    protected function configure ()
65 65
     {
66 66
         $this
67 67
             ->setName('dembelo:import')
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
             );
92 92
     }
93 93
 
94
-    protected function execute(InputInterface $input, OutputInterface $output)
94
+    protected function execute (InputInterface $input, OutputInterface $output)
95 95
     {
96 96
         $importTwine = $this->getContainer()->get('admin.import.twine');
97 97
         $this->output = $output;
98 98
         $this->prepare($input);
99 99
 
100 100
         if (file_exists($this->twineArchivePath) !== true) {
101
-            $this->output->writeln("<error>Parameter 'twine-archive-file': File '".$this->twineArchivePath."' doesn't exist.</error>");
101
+            $this->output->writeln("<error>Parameter 'twine-archive-file': File '" . $this->twineArchivePath . "' doesn't exist.</error>");
102 102
 
103 103
             return -1;
104 104
         }
105 105
 
106 106
         if (is_readable($this->twineArchivePath) !== true) {
107
-            $this->output->writeln("<error>Parameter 'twine-archive-file': File '".$this->twineArchivePath."' isn't readable.</error>");
107
+            $this->output->writeln("<error>Parameter 'twine-archive-file': File '" . $this->twineArchivePath . "' isn't readable.</error>");
108 108
 
109 109
             return -1;
110 110
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
             $this->dm->flush();
125 125
         } catch (\Exception $ex) {
126
-            $output->writeln('<error>'.$ex->getMessage().'</error>');
126
+            $output->writeln('<error>' . $ex->getMessage() . '</error>');
127 127
 
128 128
             $importTwine->parserFree();
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         return 0;
134 134
     }
135 135
 
136
-    private function prepare(InputInterface $input)
136
+    private function prepare (InputInterface $input)
137 137
     {
138 138
         $styleWarning = new OutputFormatterStyle('black', 'yellow');
139 139
         $this->output->getFormatter()->setStyle('warning', $styleWarning);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
          */
152 152
         $licensee = $repositoryLicensee->findOneByName($input->getOption('licensee-name'));
153 153
         if (is_null($licensee)) {
154
-            throw new \Exception("<error>A Licensee named '".$input->getOption('licensee-name')."' doesn't exist.</error>");
154
+            throw new \Exception("<error>A Licensee named '" . $input->getOption('licensee-name') . "' doesn't exist.</error>");
155 155
         }
156 156
 
157 157
         $this->author = $input->getOption('metadata-author');
Please login to merge, or discard this patch.
www/src/DembeloMain/Tests/Model/FavoriteManagerTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * @inheritdoc
48 48
      */
49
-    public function setUp()
49
+    public function setUp ()
50 50
     {
51 51
         parent::setUp(); // TODO: Change the autogenerated stub
52 52
         $this->topic = new Topic();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * tests setting of a favorite via cookie
66 66
      */
67
-    public function testSetFavoriteWithCookie()
67
+    public function testSetFavoriteWithCookie ()
68 68
     {
69 69
         $this->favMgr->setFavorite($this->textnode);
70 70
         $this->assertEquals('textnodeId', $this->favMgr->getFavorite($this->topic));
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * tests setting of a favorite via user object
76 76
      */
77
-    public function testSetFavoriteWithUser()
77
+    public function testSetFavoriteWithUser ()
78 78
     {
79 79
         $this->favMgr->setFavorite($this->textnode, $this->user);
80 80
         $this->assertEquals('textnodeId', $this->favMgr->getFavorite($this->topic, $this->user));
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * tests setting of a favorite across multiple instances via user object
86 86
      */
87
-    public function testSetFavoriteWithMultipleInstancesWithUser()
87
+    public function testSetFavoriteWithMultipleInstancesWithUser ()
88 88
     {
89 89
         $this->favMgr->setFavorite($this->textnode, $this->user);
90 90
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     /**
97 97
      * tests setting of a favorite across multiple instances via cookie
98 98
      */
99
-    public function testSetFavoriteWithMultipleInstancesWithCookie()
99
+    public function testSetFavoriteWithMultipleInstancesWithCookie ()
100 100
     {
101 101
         $this->favMgr->setFavorite($this->textnode);
102 102
 
Please login to merge, or discard this patch.