@@ -45,7 +45,7 @@ |
||
45 | 45 | public function testExtract(): void |
46 | 46 | { |
47 | 47 | $tmpName = tempnam('/tmp', 'unittest'); |
48 | - $createdFilename = $tmpName.'.extracted'; |
|
48 | + $createdFilename = $tmpName . '.extracted'; |
|
49 | 49 | $content = <<< END |
50 | 50 | nonsens |
51 | 51 | lots of stuff |
@@ -32,9 +32,9 @@ |
||
32 | 32 | public function extract(string $filename): string |
33 | 33 | { |
34 | 34 | if (!is_readable($filename)) { |
35 | - throw new \InvalidArgumentException('Failed to read data from file ['.$filename.'].'); |
|
35 | + throw new \InvalidArgumentException('Failed to read data from file [' . $filename . '].'); |
|
36 | 36 | } |
37 | - $extractedFilename = $filename.'.extracted'; |
|
37 | + $extractedFilename = $filename . '.extracted'; |
|
38 | 38 | $fileHandle = fopen($filename, 'r'); |
39 | 39 | $extractedFileHandle = fopen($extractedFilename, 'w'); |
40 | 40 | $writing = false; |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | $contentArray = explode('-->', $content, 2); |
68 | 68 | |
69 | 69 | if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) { |
70 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."-->".$contentArray[1]."]]'."); |
|
70 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "-->" . $contentArray[1] . "]]'."); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $externalTextnode = $this->textnodeRepository->find($contentArray[1]); |
74 | 74 | |
75 | 75 | if (null === $externalTextnode) { |
76 | - throw new Exception("There is a textnode which references the external Dembelo Textnode '".$contentArray[1]."', but a Dembelo Textnode with such an Id doesn't exist."); |
|
76 | + throw new Exception("There is a textnode which references the external Dembelo Textnode '" . $contentArray[1] . "', but a Dembelo Textnode with such an Id doesn't exist."); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $hitch = array(); |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | $contentArray = explode("->", $content, 2); |
96 | 96 | |
97 | 97 | if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) { |
98 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."->".$contentArray[1]."]]'."); |
|
98 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "->" . $contentArray[1] . "]]'."); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if (array_key_exists($contentArray[1], $this->nodeNameMapping) !== true) { |
102 | - throw new Exception("There is a textnode which references another textnode named '".$contentArray[1]."', but this textnode doesn't exist within the same story."); |
|
102 | + throw new Exception("There is a textnode which references another textnode named '" . $contentArray[1] . "', but this textnode doesn't exist within the same story."); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $hitch = array(); |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | $contentArray = explode("<-", $content, 2); |
122 | 122 | |
123 | 123 | if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) { |
124 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0]."<-".$contentArray[1]."]]'."); |
|
124 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . "<-" . $contentArray[1] . "]]'."); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | if (array_key_exists($contentArray[0], $this->nodeNameMapping) !== true) { |
128 | - throw new Exception("There is a textnode in the Twine archive file which references another textnode named '".$contentArray[0]."', but this textnode doesn't exist within the same story."); |
|
128 | + throw new Exception("There is a textnode in the Twine archive file which references another textnode named '" . $contentArray[0] . "', but this textnode doesn't exist within the same story."); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $hitch = array(); |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | public function parseSimpleHitch(string $content, string $name): array |
146 | 146 | { |
147 | 147 | if (strlen($content) <= 0) { |
148 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content."]]'."); |
|
148 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content . "]]'."); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (array_key_exists($content, $this->nodeNameMapping) !== true) { |
152 | - 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."); |
|
152 | + 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."); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $hitch = array(); |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | $peekData = fread($fileHandler, 1024); |
41 | 41 | |
42 | 42 | if ($peekData === false) { |
43 | - throw new \Exception("Failed to read data from file '".$filename."'."); |
|
43 | + throw new \Exception("Failed to read data from file '" . $filename . "'."); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $peekDataLength = strlen($peekData); |
47 | 47 | |
48 | 48 | if ($peekDataLength <= 0) { |
49 | - throw new \Exception("File '".$filename."' seems to be empty."); |
|
49 | + throw new \Exception("File '" . $filename . "' seems to be empty."); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | for ($i = 0; $i < $peekDataLength; $i++) { |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($peekDataLength - $i < $magicStringLength) { |
62 | - throw new \Exception("File '".$filename."' isn't a Twine archive file."); |
|
62 | + throw new \Exception("File '" . $filename . "' isn't a Twine archive file."); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if (substr($peekData, $i, $magicStringLength) !== self::OPENING_STRING) { |
66 | - throw new \Exception("File '".$filename."' isn't a Twine archive file."); |
|
66 | + throw new \Exception("File '" . $filename . "' isn't a Twine archive file."); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if (fseek($fileHandler, 0) !== 0) { |
70 | - throw new \Exception("Couldn't reset reading position after the magic string in the Twine archive file '".$filename."' was checked."); |
|
70 | + throw new \Exception("Couldn't reset reading position after the magic string in the Twine archive file '" . $filename . "' was checked."); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | |
76 | - throw new \Exception("File '".$filename."' doesn't seem to be a Twine archive file."); |
|
76 | + throw new \Exception("File '" . $filename . "' doesn't seem to be a Twine archive file."); |
|
77 | 77 | } |
78 | 78 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | { |
51 | 51 | $tmpName = @tempnam('/tmp/phpunit', 'filecheck'); |
52 | 52 | $fileHandler = fopen($tmpName, 'r+'); |
53 | - fwrite($fileHandler, ' '."\n".'<tw-storydata hurz'); |
|
53 | + fwrite($fileHandler, ' ' . "\n" . '<tw-storydata hurz'); |
|
54 | 54 | fseek($fileHandler, 0); |
55 | 55 | |
56 | 56 | $fileCheck = new FileCheck(); |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | ->willReturn('readable.extracted'); |
267 | 267 | |
268 | 268 | self::$freadStack = [ |
269 | - '<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", |
|
270 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
269 | + '<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", |
|
270 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
271 | 271 | '<tw-passagedata pid="1" name="someNodeName" tags="Freigegeben ID:foobar" position="104,30">lorem impsum', |
272 | 272 | 'lorem impsum</tw-passagedata></tw-storydata>', |
273 | 273 | ]; |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | ->willReturn('readable.extracted'); |
304 | 304 | |
305 | 305 | self::$freadStack = [ |
306 | - '<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", |
|
307 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
306 | + '<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", |
|
307 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
308 | 308 | '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
309 | 309 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
310 | 310 | ]; |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | ->willReturn('readable.extracted'); |
371 | 371 | |
372 | 372 | self::$freadStack = [ |
373 | - '<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", |
|
374 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
373 | + '<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", |
|
374 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
375 | 375 | '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum', |
376 | 376 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
377 | 377 | ]; |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | ->willReturn('readable.extracted'); |
402 | 402 | |
403 | 403 | self::$freadStack = [ |
404 | - '<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", |
|
405 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
404 | + '<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", |
|
405 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
406 | 406 | '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum', |
407 | 407 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
408 | 408 | ]; |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | ->willReturn('readable.extracted'); |
433 | 433 | |
434 | 434 | self::$freadStack = [ |
435 | - '<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", |
|
436 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
435 | + '<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", |
|
436 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
437 | 437 | '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
438 | 438 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
439 | 439 | ]; |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | ->willReturn('readable.extracted'); |
467 | 467 | |
468 | 468 | self::$freadStack = [ |
469 | - '<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", |
|
470 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
469 | + '<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", |
|
470 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
471 | 471 | '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
472 | 472 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
473 | 473 | ]; |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | ->willReturn('readable.extracted'); |
503 | 503 | |
504 | 504 | self::$freadStack = [ |
505 | - '<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", |
|
506 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
505 | + '<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", |
|
506 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
507 | 507 | '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
508 | 508 | 'lorem ipsum</tw-passagedata></tw-storydata>', |
509 | 509 | ]; |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | ->willReturn('readable.extracted'); |
541 | 541 | |
542 | 542 | self::$freadStack = [ |
543 | - '<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", |
|
544 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
543 | + '<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", |
|
544 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
545 | 545 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId" position="104,30">lorem ipsum', |
546 | 546 | 'lorem ipsum</tw-passagedata>', |
547 | 547 | '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId" position="104,30">lorem ipsum', |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | ->willReturn('readable.extracted'); |
575 | 575 | |
576 | 576 | self::$freadStack = [ |
577 | - '<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", |
|
578 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
577 | + '<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", |
|
578 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
579 | 579 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
580 | 580 | 'lorem ipsum</tw-passagedata>', |
581 | 581 | '</tw-storydata>', |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | ->method('save') |
608 | 608 | ->willReturnCallback(function ($textnode) { |
609 | 609 | static $counter = 0; |
610 | - $textnode->setId('someTextnode'.$counter++); |
|
610 | + $textnode->setId('someTextnode' . $counter++); |
|
611 | 611 | }); |
612 | 612 | |
613 | 613 | $returnValue = $this->importTwine->run($importfile); |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | ->willReturn('readable.extracted'); |
631 | 631 | |
632 | 632 | self::$freadStack = [ |
633 | - '<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", |
|
634 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
633 | + '<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", |
|
634 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
635 | 635 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
636 | 636 | 'lorem ipsum</tw-passagedata>', |
637 | 637 | '</tw-storydata>', |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | ->method('save') |
661 | 661 | ->willReturnCallback(function ($textnode) { |
662 | 662 | static $counter = 0; |
663 | - $textnode->setId('someTextnode'.$counter++); |
|
663 | + $textnode->setId('someTextnode' . $counter++); |
|
664 | 664 | }); |
665 | 665 | |
666 | 666 | $returnValue = $this->importTwine->run($importfile); |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | ->willReturn('readable.extracted'); |
684 | 684 | |
685 | 685 | self::$freadStack = [ |
686 | - '<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", |
|
687 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
686 | + '<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", |
|
687 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
688 | 688 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
689 | 689 | 'lorem ipsum</tw-passagedata>', |
690 | 690 | '</tw-storydata>', |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | ->method('save') |
714 | 714 | ->willReturnCallback(function ($textnode) { |
715 | 715 | static $counter = 0; |
716 | - $textnode->setId('someTextnode'.$counter++); |
|
716 | + $textnode->setId('someTextnode' . $counter++); |
|
717 | 717 | }); |
718 | 718 | |
719 | 719 | $returnValue = $this->importTwine->run($importfile); |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | ->willReturn('readable.extracted'); |
737 | 737 | |
738 | 738 | self::$freadStack = [ |
739 | - '<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", |
|
740 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
739 | + '<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", |
|
740 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
741 | 741 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
742 | 742 | 'lorem ipsum</tw-passagedata>', |
743 | 743 | '</tw-storydata>', |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | ->method('save') |
767 | 767 | ->willReturnCallback(function ($textnode) { |
768 | 768 | static $counter = 0; |
769 | - $textnode->setId('someTextnode'.$counter++); |
|
769 | + $textnode->setId('someTextnode' . $counter++); |
|
770 | 770 | }); |
771 | 771 | |
772 | 772 | $returnValue = $this->importTwine->run($importfile); |
@@ -789,15 +789,15 @@ discard block |
||
789 | 789 | ->willReturn('readable.extracted'); |
790 | 790 | |
791 | 791 | self::$freadStack = [ |
792 | - '<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", |
|
793 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
792 | + '<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", |
|
793 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
794 | 794 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
795 | 795 | 'lorem ipsum</tw-passagedata>', |
796 | 796 | '</tw-storydata>', |
797 | 797 | ]; |
798 | 798 | |
799 | 799 | $textnode1 = new Textnode(); |
800 | - $textnode1->setText('lorem ipsum'."\n"."foo bar"); |
|
800 | + $textnode1->setText('lorem ipsum' . "\n" . "foo bar"); |
|
801 | 801 | $textnode1->setId('someId0'); |
802 | 802 | |
803 | 803 | $this->textnodeRepository->expects($this->any()) |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | ->method('save') |
809 | 809 | ->willReturnCallback(function ($textnode) { |
810 | 810 | static $counter = 0; |
811 | - $textnode->setId('someTextnode'.$counter++); |
|
811 | + $textnode->setId('someTextnode' . $counter++); |
|
812 | 812 | }); |
813 | 813 | |
814 | 814 | $returnValue = $this->importTwine->run($importfile); |
@@ -830,8 +830,8 @@ discard block |
||
830 | 830 | ->willReturn('readable.extracted'); |
831 | 831 | |
832 | 832 | self::$freadStack = [ |
833 | - '<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", |
|
834 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
833 | + '<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", |
|
834 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
835 | 835 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
836 | 836 | 'lorem ipsum</tw-passagedata>', |
837 | 837 | '</tw-storydata>', |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | ->method('save') |
876 | 876 | ->willReturnCallback(function ($textnode) { |
877 | 877 | static $counter = 0; |
878 | - $textnode->setId('someTextnode'.$counter++); |
|
878 | + $textnode->setId('someTextnode' . $counter++); |
|
879 | 879 | }); |
880 | 880 | |
881 | 881 | $returnValue = $this->importTwine->run($importfile); |
@@ -897,8 +897,8 @@ discard block |
||
897 | 897 | ->willReturn('readable.extracted'); |
898 | 898 | |
899 | 899 | self::$freadStack = [ |
900 | - '<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", |
|
901 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
900 | + '<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", |
|
901 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
902 | 902 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
903 | 903 | 'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>', |
904 | 904 | '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum', |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | ->willReturn('readable.extracted'); |
941 | 941 | |
942 | 942 | self::$freadStack = [ |
943 | - '<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", |
|
944 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
943 | + '<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", |
|
944 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
945 | 945 | '<tw-passagedata name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
946 | 946 | 'lorem ipsum</tw-passagedata>', |
947 | 947 | '</tw-storydata>', |
@@ -970,8 +970,8 @@ discard block |
||
970 | 970 | ->willReturn('readable.extracted'); |
971 | 971 | |
972 | 972 | self::$freadStack = [ |
973 | - '<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", |
|
974 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
973 | + '<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", |
|
974 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
975 | 975 | '<tw-passagedata pid="nonnumeric" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
976 | 976 | 'lorem ipsum</tw-passagedata>', |
977 | 977 | '</tw-storydata>', |
@@ -1000,8 +1000,8 @@ discard block |
||
1000 | 1000 | ->willReturn('readable.extracted'); |
1001 | 1001 | |
1002 | 1002 | self::$freadStack = [ |
1003 | - '<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", |
|
1004 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
1003 | + '<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", |
|
1004 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
1005 | 1005 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">', |
1006 | 1006 | '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,40">Lorem Ipsum', |
1007 | 1007 | 'lorem ipsum</tw-passagedata>', |
@@ -1031,8 +1031,8 @@ discard block |
||
1031 | 1031 | ->willReturn('readable.extracted'); |
1032 | 1032 | |
1033 | 1033 | self::$freadStack = [ |
1034 | - '<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", |
|
1035 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
1034 | + '<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", |
|
1035 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
1036 | 1036 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
1037 | 1037 | 'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>', |
1038 | 1038 | '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum', |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | ->willReturn('readable.extracted'); |
1069 | 1069 | |
1070 | 1070 | self::$freadStack = [ |
1071 | - '<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", |
|
1072 | - '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
|
1071 | + '<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", |
|
1072 | + '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>' . "\n", |
|
1073 | 1073 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
1074 | 1074 | 'lorem ipsum [[Linkdata->someNodeName2]]</tw-passagedata>', |
1075 | 1075 | '<tw-passagedata pid="2" name="someNodeName2" tags="ID:someTwineId2" position="104,30">lorem ipsum', |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | public function testRunWithParserException(): void |
1101 | 1101 | { |
1102 | 1102 | self::$freadStack = [ |
1103 | - '<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", |
|
1103 | + '<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", |
|
1104 | 1104 | '<tw-passagedata pid"1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
1105 | 1105 | 'lorem ipsum</tw-passagedata>', |
1106 | 1106 | '</tw-storydata>', |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | public function testRunWithInvalidStoryDataElement(): void |
1135 | 1135 | { |
1136 | 1136 | self::$freadStack = [ |
1137 | - '<tw-storydata 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", |
|
1137 | + '<tw-storydata 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", |
|
1138 | 1138 | '<tw-passagedata pid="1" name="someNodeName1" tags="ID:someTwineId1" position="104,30">lorem ipsum', |
1139 | 1139 | 'lorem ipsum</tw-passagedata>', |
1140 | 1140 | '</tw-storydata>', |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $fileHandler = fopen($filenameExtracted, "rb"); |
123 | 123 | |
124 | 124 | if ($fileHandler === false) { |
125 | - throw new Exception("Couldn't open file '".$this->importfile->getFilename()."'"); |
|
125 | + throw new Exception("Couldn't open file '" . $this->importfile->getFilename() . "'"); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $this->xmlParser = xml_parser_create("UTF-8"); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $errorCode = xml_get_error_code($this->xmlParser); |
164 | 164 | $errorDescription = xml_error_string($errorCode); |
165 | 165 | |
166 | - throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope head for the Twine archive was parsed."); |
|
166 | + throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope head for the Twine archive was parsed."); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $errorCode = xml_get_error_code($this->xmlParser); |
174 | 174 | $errorDescription = xml_error_string($errorCode); |
175 | 175 | |
176 | - throw new Exception("Error #".$errorCode.": '".$errorDescription."' occurred while the envelope foot for the Twine archive was parsed."); |
|
176 | + throw new Exception("Error #" . $errorCode . ": '" . $errorDescription . "' occurred while the envelope foot for the Twine archive was parsed."); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $errorColumnNumber = xml_get_current_column_number($this->xmlParser); |
224 | 224 | $errorByteIndex = xml_get_current_byte_index($this->xmlParser); |
225 | 225 | |
226 | - 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.")."); |
|
226 | + 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 . ")."); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | private function checkElementStoryData(string $name, array $attributes): bool |
246 | 246 | { |
247 | 247 | if ($this->twineRelevant === true) { |
248 | - throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'."); |
|
248 | + throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'."); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | if (isset($attributes['startnode']) !== true) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | if (isset($attributes['name']) !== true) { |
260 | - throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'name' attribute."); |
|
260 | + throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'name' attribute."); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | return true; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | private function getTwineId(string $tagString, string $textnodeTitle): string |
267 | 267 | { |
268 | 268 | if (empty($tagString) || !is_string($tagString)) { |
269 | - throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"'); |
|
269 | + throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"'); |
|
270 | 270 | } |
271 | 271 | $tagArray = explode(' ', $tagString); |
272 | 272 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | if ($twineId === false) { |
282 | - throw new Exception('no ID given for Textnode "'.$textnodeTitle.'"'); |
|
282 | + throw new Exception('no ID given for Textnode "' . $textnodeTitle . '"'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | return $twineId; |
@@ -301,21 +301,21 @@ discard block |
||
301 | 301 | private function startElementPassageData(string $name, array $attrs): void |
302 | 302 | { |
303 | 303 | if ($this->twineText !== false) { |
304 | - throw new Exception("Nested '".$name."' found in Twine archive file '".$this->importfile->getFilename()."'."); |
|
304 | + throw new Exception("Nested '" . $name . "' found in Twine archive file '" . $this->importfile->getFilename() . "'."); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | if (isset($attrs['pid']) !== true) { |
308 | - throw new Exception("There is a '".$name."' in the Twine archive file '".$this->importfile->getFilename()."' which is missing its 'pid' attribute."); |
|
308 | + throw new Exception("There is a '" . $name . "' in the Twine archive file '" . $this->importfile->getFilename() . "' which is missing its 'pid' attribute."); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | if (is_numeric($attrs['pid']) !== true) { |
312 | - 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)."); |
|
312 | + 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)."); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | $this->twineId = $this->getTwineId($attrs['tags'], $attrs['name']); |
316 | 316 | |
317 | 317 | if (array_key_exists($this->twineId, $this->textnodeMapping) === true) { |
318 | - 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']."'"); |
|
318 | + 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'] . "'"); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | $this->twineTextnodeName = $attrs['name']; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $this->textnode->setAccess(true); |
342 | 342 | $this->accessSet = true; |
343 | 343 | } else { |
344 | - 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.'); |
|
344 | + 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.'); |
|
345 | 345 | } |
346 | 346 | } else { |
347 | 347 | $this->textnode->setAccess(false); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | private function characterData($parser, string $data) |
363 | 363 | { |
364 | 364 | if ($this->twineRelevant === true && $this->twineText === true) { |
365 | - $this->textnode->setText($this->textnode->getText().$data); |
|
365 | + $this->textnode->setText($this->textnode->getText() . $data); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $textnode = $this->textnodeRepository->find($dembeloId); |
406 | 406 | |
407 | 407 | if (null === $textnode) { |
408 | - throw new Exception('The Dembelo Textnode with Id \''.$dembeloId.'\' doesn\'t exist, but should by now.'); |
|
408 | + throw new Exception('The Dembelo Textnode with Id \'' . $dembeloId . '\' doesn\'t exist, but should by now.'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | $textnodeText = $textnode->getText(); |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | * @param array|null $hitch |
425 | 425 | * @throws Exception |
426 | 426 | */ |
427 | - private function appendHitchToTextnode(Textnode $textnode, ?array $hitch): void |
|
427 | + private function appendHitchToTextnode(Textnode $textnode, ? array $hitch) : void |
|
428 | 428 | { |
429 | 429 | if ($hitch === null) { |
430 | 430 | return; |
431 | 431 | } |
432 | 432 | if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) { |
433 | - throw new Exception('There is a textnode in the Twine archive file which has more than '.Textnode::HITCHES_MAXIMUM_COUNT.' links.'); |
|
433 | + throw new Exception('There is a textnode in the Twine archive file which has more than ' . Textnode::HITCHES_MAXIMUM_COUNT . ' links.'); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | if ($textnode->appendHitch($hitch) !== true) { |
@@ -450,13 +450,13 @@ discard block |
||
450 | 450 | $contentArray = explode(">:<", $content, 2); |
451 | 451 | |
452 | 452 | if (strlen($contentArray[0]) <= 0 || strlen($contentArray[1]) <= 0) { |
453 | - throw new \Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$contentArray[0].">:<".$contentArray[1]."]]'."); |
|
453 | + throw new \Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $contentArray[0] . ">:<" . $contentArray[1] . "]]'."); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $metadata = $textnode->getMetadata() ?? []; |
457 | 457 | |
458 | 458 | if (array_key_exists($contentArray[0], $metadata) === true) { |
459 | - 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."); |
|
459 | + 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."); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | $metadata[$contentArray[0]] = $contentArray[1]; |
@@ -228,7 +228,7 @@ |
||
228 | 228 | * |
229 | 229 | * @return array |
230 | 230 | */ |
231 | - public function getMetadata(): ?array |
|
231 | + public function getMetadata(): ? array |
|
232 | 232 | { |
233 | 233 | return $this->metadata; |
234 | 234 | } |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | public function startElement(string $name, array $attrs): void |
65 | 65 | { |
66 | 66 | if ($this->parserContext->isTwineText()) { |
67 | - throw new \Exception("Nested '".$name."' found in Twine archive file '".$this->parserContext->getFilename()."'."); |
|
67 | + throw new \Exception("Nested '" . $name . "' found in Twine archive file '" . $this->parserContext->getFilename() . "'."); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if (isset($attrs['pid']) !== true) { |
71 | - throw new \Exception("There is a '".$name."' in the Twine archive file '".$this->parserContext->getFilename()."' which is missing its 'pid' attribute."); |
|
71 | + throw new \Exception("There is a '" . $name . "' in the Twine archive file '" . $this->parserContext->getFilename() . "' which is missing its 'pid' attribute."); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if (is_numeric($attrs['pid']) !== true) { |
75 | - throw new \Exception("There is a '".$name."' in the Twine archive file '".$this->parserContext->getFilename()."' which hasn't a numeric value in its 'pid' attribute ('".$attrs['pid']."' was found instead)."); |
|
75 | + throw new \Exception("There is a '" . $name . "' in the Twine archive file '" . $this->parserContext->getFilename() . "' which hasn't a numeric value in its 'pid' attribute ('" . $attrs['pid'] . "' was found instead)."); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $twineId = $this->getTwineId($attrs['tags'], $attrs['name']); |
79 | 79 | |
80 | 80 | if (array_key_exists($twineId, $this->parserContext->getTextnodeMapping()) === true) { |
81 | - throw new \Exception("There is a '".$name."' in the Twine archive file '".$this->parserContext->getFilename()."' which has a non unique 'id' tag [".$twineId."], in node '".$attrs['name']."'"); |
|
81 | + throw new \Exception("There is a '" . $name . "' in the Twine archive file '" . $this->parserContext->getFilename() . "' which has a non unique 'id' tag [" . $twineId . "], in node '" . $attrs['name'] . "'"); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | $textnode = $this->textnodeRepository->findByTwineId($this->parserContext->getImportfile(), $twineId); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $textnode->setAccess(true); |
103 | 103 | $this->parserContext->setAccessSet(true); |
104 | 104 | } else { |
105 | - throw new \Exception('There is more than one \''.$name.'\' in the Twine archive file \''.$this->parserContext->getFilename().'\' with the startnode value \''.$attrs['pid'].'\' in its \'pid\' attribute.'); |
|
105 | + throw new \Exception('There is more than one \'' . $name . '\' in the Twine archive file \'' . $this->parserContext->getFilename() . '\' with the startnode value \'' . $attrs['pid'] . '\' in its \'pid\' attribute.'); |
|
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | $textnode->setAccess(false); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | private function getTwineId(string $tagString, string $textnodeTitle): string |
140 | 140 | { |
141 | 141 | if (empty($tagString)) { |
142 | - throw new \Exception('no ID given for Textnode "'.$textnodeTitle.'"'); |
|
142 | + throw new \Exception('no ID given for Textnode "' . $textnodeTitle . '"'); |
|
143 | 143 | } |
144 | 144 | $tagArray = explode(' ', $tagString); |
145 | 145 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | if ($twineId === false) { |
155 | - throw new \Exception('no ID given for Textnode "'.$textnodeTitle.'"'); |
|
155 | + throw new \Exception('no ID given for Textnode "' . $textnodeTitle . '"'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $twineId; |