@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @inheritdoc |
79 | 79 | */ |
80 | - protected function setUp(): void |
|
80 | + protected function setUp (): void |
|
81 | 81 | { |
82 | 82 | self::bootKernel(); |
83 | 83 | $application = new Application(self::$kernel); |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * tests the execute method |
93 | 93 | */ |
94 | - public function testExecute(): void |
|
94 | + public function testExecute (): void |
|
95 | 95 | { |
96 | 96 | $this->mockObjects['importTwine']->expects($this->once()) |
97 | 97 | ->method('run') |
98 | - ->will($this->returnCallback(function ($importfile) { |
|
98 | + ->will($this->returnCallback(function($importfile) { |
|
99 | 99 | return $importfile->getFilename() === 'somefile_readable_exists.html' |
100 | 100 | && $importfile->getLicenseeId() === 'licenseeId' |
101 | 101 | && $importfile->getAuthor() === 'someauthor' |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * tests execute method with unreadable file |
121 | 121 | */ |
122 | - public function testExecuteWithUnreadableFile(): void |
|
122 | + public function testExecuteWithUnreadableFile (): void |
|
123 | 123 | { |
124 | 124 | $this->mockObjects['importTwine']->expects($this->never()) |
125 | 125 | ->method('run'); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * tests execute() method with non existing file |
143 | 143 | */ |
144 | - public function testExecuteWithFileNotExisting(): void |
|
144 | + public function testExecuteWithFileNotExisting (): void |
|
145 | 145 | { |
146 | 146 | $this->mockObjects['importTwine']->expects($this->never()) |
147 | 147 | ->method('run'); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * tests execute() method with exception thrown by importTwine |
165 | 165 | */ |
166 | - public function testExecuteWithExeptionInImportTwine(): void |
|
166 | + public function testExecuteWithExeptionInImportTwine (): void |
|
167 | 167 | { |
168 | 168 | $this->mockObjects['importTwine']->expects($this->once()) |
169 | 169 | ->method('run') |
170 | - ->will($this->returnCallback(function ($importfile) { |
|
170 | + ->will($this->returnCallback(function($importfile) { |
|
171 | 171 | return $importfile->getFilename() === 'somefile_readable_exists.html' |
172 | 172 | && $importfile->getLicenseeId() === 'licenseeId' |
173 | 173 | && $importfile->getAuthor() === 'someauthor' |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * @expectedException \Exception |
197 | 197 | */ |
198 | - public function testExecuteWithLicenseeNotFound(): void |
|
198 | + public function testExecuteWithLicenseeNotFound (): void |
|
199 | 199 | { |
200 | 200 | $this->mockObjects['importTwine']->expects($this->never()) |
201 | 201 | ->method('run'); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @param string $arg |
222 | 222 | * @return null|\PHPUnit_Framework_MockObject_MockObject |
223 | 223 | */ |
224 | - public function findOneByNameCallback($arg): Licensee |
|
224 | + public function findOneByNameCallback ($arg): Licensee |
|
225 | 225 | { |
226 | 226 | if ($arg === 'somelicensee') { |
227 | 227 | $licenseeMock = $this->getMockBuilder('DembeloMain\Document\Licensee')->disableOriginalConstructor()->getMock(); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | /** |
239 | 239 | * @return array |
240 | 240 | */ |
241 | - private function getMockObjects(): array |
|
241 | + private function getMockObjects (): array |
|
242 | 242 | { |
243 | 243 | $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); |
244 | 244 |
@@ -76,7 +76,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,11 +456,11 @@ discard block |
||
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 | - 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."); |
|
463 | + 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 | 464 | } |
465 | 465 | |
466 | 466 | $hitch = array(); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $content = explode(">:<", $content, 2); |
472 | 472 | |
473 | 473 | if (strlen($content[0]) <= 0 || strlen($content[1]) <= 0) { |
474 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content[0].">:<".$content[1]."]]'."); |
|
474 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content[0] . ">:<" . $content[1] . "]]'."); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | $metadata = $textnode->getMetadata(); |
@@ -481,17 +481,17 @@ discard block |
||
481 | 481 | } |
482 | 482 | |
483 | 483 | if (array_key_exists($content[0], $metadata) === true) { |
484 | - 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."); |
|
484 | + 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 | 485 | } |
486 | 486 | |
487 | 487 | $metadata[$content[0]] = $content[1]; |
488 | 488 | } else { |
489 | 489 | if (strlen($content) <= 0) { |
490 | - throw new Exception("The Twine archive file contains a '".$name."' with the invalid element '[[".$content."]]'."); |
|
490 | + throw new Exception("The Twine archive file contains a '" . $name . "' with the invalid element '[[" . $content . "]]'."); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | if (array_key_exists($content, $this->nodeNameMapping) !== true) { |
494 | - 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."); |
|
494 | + 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 | 495 | } |
496 | 496 | |
497 | 497 | $hitch = array(); |
@@ -502,11 +502,11 @@ discard block |
||
502 | 502 | |
503 | 503 | if ($hitch !== null) { |
504 | 504 | if ($textnode->getHitchCount() >= Textnode::HITCHES_MAXIMUM_COUNT) { |
505 | - throw new Exception("There is a textnode named '".$twineName."' in the Twine archive file which has more than ".Textnode::HITCHES_MAXIMUM_COUNT." links."); |
|
505 | + throw new Exception("There is a textnode named '" . $twineName . "' in the Twine archive file which has more than " . Textnode::HITCHES_MAXIMUM_COUNT . " links."); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | if ($textnode->appendHitch($hitch) !== true) { |
509 | - throw new Exception("Failed to append hitch for the textnode named '".$twineName."' from the Twine archive file."); |
|
509 | + throw new Exception("Failed to append hitch for the textnode named '" . $twineName . "' from the Twine archive file."); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $this->accessSet = false; |
561 | 561 | } |
562 | 562 | |
563 | - private function endElementPassageData() |
|
563 | + private function endElementPassageData () |
|
564 | 564 | { |
565 | 565 | $this->textnodeRepository->save($this->textnode); |
566 | 566 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * @param string $name |
580 | 580 | * @throws Exception |
581 | 581 | */ |
582 | - private function endElement($parser, $name) |
|
582 | + private function endElement ($parser, $name) |
|
583 | 583 | { |
584 | 584 | if ($name === "tw-storydata") { |
585 | 585 | $this->endElementStoryData($name); |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | if (null === $user) { |
287 | 287 | return new Response(\json_encode(['error' => false])); |
288 | 288 | } |
289 | - $user->setActivationHash(sha1($user->getEmail().$user->getPassword().\time())); |
|
289 | + $user->setActivationHash(sha1($user->getEmail() . $user->getPassword() . \time())); |
|
290 | 290 | |
291 | 291 | $dm->persist($user); |
292 | 292 | $dm->flush(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return Response |
315 | 315 | */ |
316 | - public function importfilesAction() |
|
316 | + public function importfilesAction () |
|
317 | 317 | { |
318 | 318 | $mongo = $this->get('doctrine_mongodb'); |
319 | 319 | /* @var $repository \Doctrine\ODM\MongoDB\DocumentRepository */ |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return Response |
345 | 345 | */ |
346 | - public function uploadImportfileAction() |
|
346 | + public function uploadImportfileAction () |
|
347 | 347 | { |
348 | 348 | $output = array(); |
349 | 349 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | |
358 | 358 | $directory = $this->container->getParameter('twine_directory'); |
359 | 359 | |
360 | - $filename = md5(uniqid().$file['name']); |
|
360 | + $filename = md5(uniqid() . $file['name']); |
|
361 | 361 | |
362 | - move_uploaded_file($file["tmp_name"], $directory.$filename); |
|
362 | + move_uploaded_file($file["tmp_name"], $directory . $filename); |
|
363 | 363 | |
364 | 364 | $output['filename'] = $filename; |
365 | 365 | $output['orgname'] = $file['name']; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * |
375 | 375 | * @return Response |
376 | 376 | */ |
377 | - public function textnodesAction() |
|
377 | + public function textnodesAction () |
|
378 | 378 | { |
379 | 379 | $repository = $this->get('app.model_repository_textNode'); |
380 | 380 | $textnodes = $repository->findAll(); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $obj->access = $textnode->getAccess() ? 'ja' : 'nein'; |
394 | 394 | $obj->licensee = $licenseeIndex[$textnode->getLicenseeId()]; |
395 | 395 | $obj->importfile = isset($importfileIndex[$textnode->getImportfileId()]) ? $importfileIndex[$textnode->getImportfileId()] : 'unbekannt'; |
396 | - $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200)."..."; |
|
396 | + $obj->beginning = substr(htmlentities(strip_tags($textnode->getText())), 0, 200) . "..."; |
|
397 | 397 | $obj->financenode = $textnode->isFinanceNode() ? 'ja' : 'nein'; |
398 | 398 | $obj->twineId = $textnode->getTwineId(); |
399 | 399 | $obj->metadata = $this->formatMetadata($textnode->getMetadata()); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * |
411 | 411 | * @return Response |
412 | 412 | */ |
413 | - public function importAction(Request $request) |
|
413 | + public function importAction (Request $request) |
|
414 | 414 | { |
415 | 415 | $importfileId = $request->get('importfileId'); |
416 | 416 | |
@@ -449,26 +449,26 @@ discard block |
||
449 | 449 | * @param string $filename filename hash |
450 | 450 | * @param string $orgname original name |
451 | 451 | */ |
452 | - private function saveFile(Importfile $item, $filename, $orgname) |
|
452 | + private function saveFile (Importfile $item, $filename, $orgname) |
|
453 | 453 | { |
454 | 454 | if (empty($filename) || empty($orgname)) { |
455 | 455 | return; |
456 | 456 | } |
457 | 457 | |
458 | 458 | $directory = $this->container->getParameter('twine_directory'); |
459 | - $finalDirectory = $directory.$item->getLicenseeId().'/'; |
|
459 | + $finalDirectory = $directory . $item->getLicenseeId() . '/'; |
|
460 | 460 | if (!is_dir($finalDirectory)) { |
461 | 461 | mkdir($finalDirectory); |
462 | 462 | } |
463 | - $finalName = $finalDirectory.$item->getId(); |
|
464 | - $file = $directory.$filename; |
|
463 | + $finalName = $finalDirectory . $item->getId(); |
|
464 | + $file = $directory . $filename; |
|
465 | 465 | rename($file, $finalName); |
466 | 466 | |
467 | 467 | $item->setOriginalname($orgname); |
468 | 468 | $item->setFilename($finalName); |
469 | 469 | } |
470 | 470 | |
471 | - private function buildLicenseeIndex() |
|
471 | + private function buildLicenseeIndex () |
|
472 | 472 | { |
473 | 473 | $repository = $this->get('app.model_repository_licensee'); |
474 | 474 | $licensees = $repository->findAll(); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | return $index; |
481 | 481 | } |
482 | 482 | |
483 | - private function buildImportfileIndex() |
|
483 | + private function buildImportfileIndex () |
|
484 | 484 | { |
485 | 485 | $repository = $this->get('app.model_repository_importfile'); |
486 | 486 | $importfiles = $repository->findAll(); |
@@ -499,28 +499,28 @@ discard block |
||
499 | 499 | * @param string $filename filename hash |
500 | 500 | * @param string $orgname original name |
501 | 501 | */ |
502 | - private function saveTopicImage(Topic $item, $filename, $orgname) |
|
502 | + private function saveTopicImage (Topic $item, $filename, $orgname) |
|
503 | 503 | { |
504 | 504 | if (empty($filename) || empty($orgname)) { |
505 | 505 | return; |
506 | 506 | } |
507 | 507 | $directory = $this->container->getParameter('topic_image_directory'); |
508 | - $finalDirectory = $directory.$item->getId().'/'; |
|
508 | + $finalDirectory = $directory . $item->getId() . '/'; |
|
509 | 509 | if (!is_dir($finalDirectory)) { |
510 | 510 | mkdir($finalDirectory); |
511 | 511 | } |
512 | - $finalName = $finalDirectory.$orgname; |
|
513 | - $file = $directory.$filename; |
|
512 | + $finalName = $finalDirectory . $orgname; |
|
513 | + $file = $directory . $filename; |
|
514 | 514 | rename($file, $finalName); |
515 | 515 | $item->setOriginalImageName($orgname); |
516 | 516 | $item->setImageFilename($finalName); |
517 | 517 | } |
518 | 518 | |
519 | - private function formatMetadata(array $metadata) |
|
519 | + private function formatMetadata (array $metadata) |
|
520 | 520 | { |
521 | 521 | $string = ''; |
522 | 522 | foreach ($metadata as $key => $value) { |
523 | - $string .= $key.': '.$value."\n"; |
|
523 | + $string .= $key . ': ' . $value . "\n"; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | return $string; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * FavoriteManager constructor. |
39 | 39 | * @param Session $session |
40 | 40 | */ |
41 | - public function __construct(Session $session) |
|
41 | + public function __construct (Session $session) |
|
42 | 42 | { |
43 | 43 | $this->session = $session; |
44 | 44 | } |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @param Textnode $textnode |
49 | 49 | * @param User|null $user |
50 | 50 | */ |
51 | - public function setFavorite(Textnode $textnode, User $user = null): void |
|
51 | + public function setFavorite (Textnode $textnode, User $user = null): void |
|
52 | 52 | { |
53 | 53 | if (null === $user) { |
54 | - $this->session->set('favorite_'.$textnode->getTopicId(), $textnode->getArbitraryId()); |
|
54 | + $this->session->set('favorite_' . $textnode->getTopicId(), $textnode->getArbitraryId()); |
|
55 | 55 | |
56 | 56 | return; |
57 | 57 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @param User|null $user |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function getFavorite(Topic $topic, User $user = null): string |
|
67 | + public function getFavorite (Topic $topic, User $user = null): string |
|
68 | 68 | { |
69 | 69 | if (null === $user) { |
70 | - return $this->session->get('favorite_'.$topic->getId()); |
|
70 | + return $this->session->get('favorite_' . $topic->getId()); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $user->getFavorite($topic->getId()); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @param string $id |
35 | 35 | * @return Topic |
36 | 36 | */ |
37 | - public function find($id); |
|
37 | + public function find ($id); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Find all topics |
41 | 41 | * @return Topic[] |
42 | 42 | */ |
43 | - public function findAll(); |
|
43 | + public function findAll (); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @param array $criteria |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @param integer $skip |
50 | 50 | * @return Topic[] |
51 | 51 | */ |
52 | - public function findBy(array $criteria, array $sort = null, $limit = null, $skip = null); |
|
52 | + public function findBy (array $criteria, array $sort = null, $limit = null, $skip = null); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Find all active topics |
56 | 56 | * @return Topic[] |
57 | 57 | */ |
58 | - public function findByStatusActive(); |
|
58 | + public function findByStatusActive (); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * finds filtered topics |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @param array $orderBy |
64 | 64 | * @return mixed |
65 | 65 | */ |
66 | - public function findFiltered(array $filters = array(), array $orderBy = array()); |
|
66 | + public function findFiltered (array $filters = array(), array $orderBy = array()); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Save topic |
70 | 70 | * @param Topic $topic |
71 | 71 | * @return Topic |
72 | 72 | */ |
73 | - public function save($topic); |
|
73 | + public function save ($topic); |
|
74 | 74 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $importfileId |
40 | 40 | * @return Textnode[] |
41 | 41 | */ |
42 | - public function findByImportfileId($importfileId) |
|
42 | + public function findByImportfileId ($importfileId) |
|
43 | 43 | { |
44 | 44 | return $this->findBy(array('importfileId' => new MongoId($importfileId))); |
45 | 45 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param string $twineId |
51 | 51 | * @return Textnode |
52 | 52 | */ |
53 | - public function findByTwineId(Importfile $importfile, $twineId) |
|
53 | + public function findByTwineId (Importfile $importfile, $twineId) |
|
54 | 54 | { |
55 | 55 | $textnode = $this->findOneBy( |
56 | 56 | array( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $existingTextnodeIds array of textnodeIds |
69 | 69 | * @throws \Doctrine\ODM\MongoDB\MongoDBException |
70 | 70 | */ |
71 | - public function disableOrphanedNodes(Importfile $importfile, array $existingTextnodeIds) |
|
71 | + public function disableOrphanedNodes (Importfile $importfile, array $existingTextnodeIds) |
|
72 | 72 | { |
73 | 73 | $this->getDocumentManager()->createQueryBuilder(Textnode::class) |
74 | 74 | ->update() |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param string $arbitraryId textnode arbitrary id |
85 | 85 | * @return Textnode |
86 | 86 | */ |
87 | - public function findOneActiveByArbitraryId($arbitraryId): Textnode |
|
87 | + public function findOneActiveByArbitraryId ($arbitraryId): Textnode |
|
88 | 88 | { |
89 | 89 | return $this->findOneBy( |
90 | 90 | array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $id Textnode Id |
99 | 99 | * @return Textnode |
100 | 100 | */ |
101 | - public function findOneActiveById($id) |
|
101 | + public function findOneActiveById ($id) |
|
102 | 102 | { |
103 | 103 | return $this->findOneBy( |
104 | 104 | array( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param Textnode $textnode |
115 | 115 | */ |
116 | - public function setHyphenatedText(Textnode $textnode) |
|
116 | + public function setHyphenatedText (Textnode $textnode) |
|
117 | 117 | { |
118 | 118 | $hyphenator = new Hyphenator(); |
119 | 119 | $hyphenator->registerPatterns('de'); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return Textnode|null |
131 | 131 | */ |
132 | - public function getTextnodeToRead($topicId): ?Textnode |
|
132 | + public function getTextnodeToRead ($topicId): ?Textnode |
|
133 | 133 | { |
134 | 134 | return $this->createQueryBuilder() |
135 | 135 | ->field('topicId')->equals(new \MongoId($topicId)) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @param Textnode $object |
143 | 143 | */ |
144 | - protected function beforeSave($object) |
|
144 | + protected function beforeSave ($object) |
|
145 | 145 | { |
146 | 146 | parent::beforeSave($object); |
147 | 147 | if (null === $object->getArbitraryId()) { |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - private function createArbitraryId(Textnode $object): string |
|
157 | + private function createArbitraryId (Textnode $object): string |
|
158 | 158 | { |
159 | - $id = substr(md5(time().$object->getTwineId().substr($object->getText(), 0, 100)), 0, 15); |
|
159 | + $id = substr(md5(time() . $object->getTwineId() . substr($object->getText(), 0, 100)), 0, 15); |
|
160 | 160 | $exists = count($this->findBy(array('arbitraryId' => $id))) > 0; |
161 | 161 | |
162 | 162 | if ($exists) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @throws \LogicException |
47 | 47 | * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException |
48 | 48 | */ |
49 | - public function readTopicAction($topicId) |
|
49 | + public function readTopicAction ($topicId) |
|
50 | 50 | { |
51 | 51 | if ($this->container->get('app.feature_toggle')->hasFeature('login_needed') && !$this->isGranted('ROLE_USER')) { |
52 | 52 | return $this->redirectToRoute('login_route'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $textnode = $textnodeRepository->getTextnodeToRead($topicId); |
65 | 65 | |
66 | 66 | if (is_null($textnode)) { |
67 | - throw $this->createNotFoundException('No Textnode for Topic \''.$topicId.'\' found.'); |
|
67 | + throw $this->createNotFoundException('No Textnode for Topic \'' . $topicId . '\' found.'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if ($textnode->isFinanceNode()) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return string |
83 | 83 | */ |
84 | - public function readTextnodeAction($textnodeArbitraryId) |
|
84 | + public function readTextnodeAction ($textnodeArbitraryId) |
|
85 | 85 | { |
86 | 86 | if ($this->container->get('app.feature_toggle')->hasFeature('login_needed') && !$this->isGranted('ROLE_USER')) { |
87 | 87 | return $this->redirectToRoute('login_route'); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $textnode = $textnodeRepository->findOneActiveByArbitraryId($textnodeArbitraryId); |
92 | 92 | |
93 | 93 | if (is_null($textnode)) { |
94 | - throw $this->createNotFoundException('No Textnode with arbitrary ID \''.$textnode->getArbitraryId().'\' found.'); |
|
94 | + throw $this->createNotFoundException('No Textnode with arbitrary ID \'' . $textnode->getArbitraryId() . '\' found.'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if ($textnode->isFinanceNode()) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function paywallAction($textnodeId, $hitchIndex) |
|
140 | + public function paywallAction ($textnodeId, $hitchIndex) |
|
141 | 141 | { |
142 | 142 | $hitchedTextnode = $this->getTextnodeForHitchIndex($textnodeId, $hitchIndex); |
143 | 143 | |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public function imprintAction() |
|
161 | + public function imprintAction () |
|
162 | 162 | { |
163 | 163 | return $this->render('DembeloMain::default/imprint.html.twig'); |
164 | 164 | } |
165 | 165 | |
166 | - private function getTextnodeForHitchIndex($textnodeId, $hitchIndex) |
|
166 | + private function getTextnodeForHitchIndex ($textnodeId, $hitchIndex) |
|
167 | 167 | { |
168 | 168 | $textnodeRepository = $this->get('app.model_repository_textNode'); |
169 | 169 | |
170 | 170 | $textnode = $textnodeRepository->findOneActiveById($textnodeId); |
171 | 171 | |
172 | 172 | if (is_null($textnode)) { |
173 | - throw $this->createNotFoundException('No Textnode with ID \''.$textnodeId.'\' found.'); |
|
173 | + throw $this->createNotFoundException('No Textnode with ID \'' . $textnodeId . '\' found.'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $hitch = $textnode->getHitch($hitchIndex); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return $this->getTextnodeForTextnodeId($hitch['textnodeId']); |
179 | 179 | } |
180 | 180 | |
181 | - private function getTextnodeForTextnodeId($textnodeId) |
|
181 | + private function getTextnodeForTextnodeId ($textnodeId) |
|
182 | 182 | { |
183 | 183 | $textnodeRepository = $this->get('app.model_repository_textNode'); |
184 | 184 | $linkedTextnode = $textnodeRepository->findOneActiveById($textnodeId); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | private $dummyData = array(); |
47 | 47 | |
48 | - protected function configure() |
|
48 | + protected function configure () |
|
49 | 49 | { |
50 | 50 | $this |
51 | 51 | ->setName('dembelo:install') |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
67 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
67 | + protected function execute (InputInterface $input, OutputInterface $output) |
|
68 | 68 | { |
69 | 69 | |
70 | 70 | if ($input->getOption('purge-db')) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | //$dm->flush(); |
87 | 87 | } |
88 | 88 | |
89 | - protected function purgeDB() |
|
89 | + protected function purgeDB () |
|
90 | 90 | { |
91 | 91 | $collectionClasses = array( |
92 | 92 | 'DembeloMain\Document\Licensee', |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - protected function installDefaultUsers(OutputInterface $output) |
|
108 | + protected function installDefaultUsers (OutputInterface $output) |
|
109 | 109 | { |
110 | 110 | $this->installAdminUser(); |
111 | 111 | $output->writeln('admin user installed'); |
112 | 112 | } |
113 | 113 | |
114 | - protected function installAdminUser() |
|
114 | + protected function installAdminUser () |
|
115 | 115 | { |
116 | 116 | $users = array( |
117 | 117 | array( |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $this->installUsers($users); |
130 | 130 | } |
131 | 131 | |
132 | - protected function installDummyData(OutputInterface $output) |
|
132 | + protected function installDummyData (OutputInterface $output) |
|
133 | 133 | { |
134 | 134 | |
135 | 135 | $mongo = $this->getContainer()->get('doctrine_mongodb'); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $output->writeln("Hitches installed..."); |
153 | 153 | } |
154 | 154 | |
155 | - private function createLicensees(ManagerRegistry $mongo, DocumentManager $dm) |
|
155 | + private function createLicensees (ManagerRegistry $mongo, DocumentManager $dm) |
|
156 | 156 | { |
157 | 157 | $repository = $mongo->getRepository('DembeloMain:Licensee'); |
158 | 158 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($licensees as $licenseeData) { |
167 | 167 | $licensee = $repository->findOneByName($licenseeData['name']); |
168 | 168 | |
169 | - if (null ===$licensee) { |
|
169 | + if (null === $licensee) { |
|
170 | 170 | $licensee = new Licensee(); |
171 | 171 | $licensee->setName($licenseeData['name']); |
172 | 172 | $dm->persist($licensee); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - private function createUsers() |
|
178 | + private function createUsers () |
|
179 | 179 | { |
180 | 180 | $users = array( |
181 | 181 | array( |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->installUsers($users); |
204 | 204 | } |
205 | 205 | |
206 | - private function installUsers(array $users) |
|
206 | + private function installUsers (array $users) |
|
207 | 207 | { |
208 | 208 | /* @var \DembeloMain\Model\Repository\UserRepositoryInterface */ |
209 | 209 | $userRepository = $this->getContainer()->get('app.model_repository_user'); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - private function createTopics(ManagerRegistry $mongo, DocumentManager $dm) |
|
243 | + private function createTopics (ManagerRegistry $mongo, DocumentManager $dm) |
|
244 | 244 | { |
245 | 245 | $repository = $mongo->getRepository('DembeloMain:Topic'); |
246 | 246 | |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | array('name' => 'Themenfeld 9', 'status' => Topic::STATUS_ACTIVE), |
258 | 258 | ); |
259 | 259 | |
260 | - $imagesSrcFolder = $this->getContainer()->getParameter('kernel.root_dir').'/../src/DembeloMain/Resources/public/images/'; |
|
260 | + $imagesSrcFolder = $this->getContainer()->getParameter('kernel.root_dir') . '/../src/DembeloMain/Resources/public/images/'; |
|
261 | 261 | $imagesTargetFolder = $this->getContainer()->getParameter('topic_image_directory'); |
262 | 262 | |
263 | 263 | $sortKey = 1; |
264 | 264 | foreach ($topicData as $topicDatum) { |
265 | 265 | $topic = $repository->findOneByName($topicDatum['name']); |
266 | 266 | if (is_null($topic)) { |
267 | - $imagename = 'bg0'.$sortKey.'.jpg'; |
|
267 | + $imagename = 'bg0' . $sortKey . '.jpg'; |
|
268 | 268 | $topic = new Topic(); |
269 | 269 | $topic->setName($topicDatum['name']); |
270 | 270 | $topic->setStatus($topicDatum['status']); |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | $topic->setOriginalImageName($imagename); |
273 | 273 | $topic->setImageFilename($imagename); |
274 | 274 | $dm->persist($topic); |
275 | - $topicFolder = $imagesTargetFolder.'/'.$topic->getId().'/'; |
|
275 | + $topicFolder = $imagesTargetFolder . '/' . $topic->getId() . '/'; |
|
276 | 276 | mkdir($topicFolder); |
277 | - copy($imagesSrcFolder.$imagename, $topicFolder.'/'.$imagename); |
|
277 | + copy($imagesSrcFolder . $imagename, $topicFolder . '/' . $imagename); |
|
278 | 278 | $sortKey++; |
279 | 279 | } |
280 | 280 | $this->dummyData['topics'][] = $topic; |
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | - private function createTextnodes() |
|
284 | + private function createTextnodes () |
|
285 | 285 | { |
286 | 286 | $loremIpsumLength = 3500; |
287 | 287 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | - private function createHitches(DocumentManager $dm) |
|
381 | + private function createHitches (DocumentManager $dm) |
|
382 | 382 | { |
383 | 383 | if (isset($this->dummyData['textnodes']) !== true) { |
384 | 384 | return; |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | $dm->persist($this->dummyData['textnodes'][0]); |
408 | 408 | } |
409 | 409 | |
410 | - private function cleanImageDirectories() |
|
410 | + private function cleanImageDirectories () |
|
411 | 411 | { |
412 | - $topicImageDirectory = $this->getContainer()->getParameter('topic_image_directory').'/'; |
|
412 | + $topicImageDirectory = $this->getContainer()->getParameter('topic_image_directory') . '/'; |
|
413 | 413 | if (is_dir($topicImageDirectory)) { |
414 | - shell_exec('rm -r '.$topicImageDirectory.'*'); |
|
414 | + shell_exec('rm -r ' . $topicImageDirectory . '*'); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function getId() |
|
64 | + public function getId () |
|
65 | 65 | { |
66 | 66 | return $this->id; |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @param string $id |
71 | 71 | */ |
72 | - public function setId($id) |
|
72 | + public function setId ($id) |
|
73 | 73 | { |
74 | 74 | $this->id = $id; |
75 | 75 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public function getName() |
|
80 | + public function getName () |
|
81 | 81 | { |
82 | 82 | return $this->name; |
83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @param string $name |
87 | 87 | */ |
88 | - public function setName(string $name): void |
|
88 | + public function setName (string $name): void |
|
89 | 89 | { |
90 | 90 | $this->name = $name; |
91 | 91 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @return mixed |
95 | 95 | */ |
96 | - public function getTopicId() |
|
96 | + public function getTopicId () |
|
97 | 97 | { |
98 | 98 | return $this->topicId; |
99 | 99 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param mixed $topicId |
103 | 103 | */ |
104 | - public function setTopicId($topicId) |
|
104 | + public function setTopicId ($topicId) |
|
105 | 105 | { |
106 | 106 | $this->topicId = $topicId; |
107 | 107 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * @return int |
111 | 111 | */ |
112 | - public function getStatus(): int |
|
112 | + public function getStatus (): int |
|
113 | 113 | { |
114 | 114 | return $this->status; |
115 | 115 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | /** |
118 | 118 | * @param int $status |
119 | 119 | */ |
120 | - public function setStatus(int $status) |
|
120 | + public function setStatus (int $status) |
|
121 | 121 | { |
122 | 122 | $this->status = $status; |
123 | 123 | } |