|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace CodeQ\LinkChecker\Controller; |
| 6 | + |
| 7 | +use Neos\Flow\Annotations as Flow; |
| 8 | +use Neos\Fusion\View\FusionView; |
| 9 | +use Neos\Neos\Controller\Module\AbstractModuleController; |
| 10 | + |
| 11 | +/** |
| 12 | + * @Flow\Scope("singleton") |
| 13 | + */ |
| 14 | +class ModuleController extends AbstractModuleController |
| 15 | +{ |
| 16 | + /** |
| 17 | + * @var FusionView |
| 18 | + */ |
| 19 | + protected $view; |
| 20 | + |
| 21 | + /** |
| 22 | + * @var string |
| 23 | + */ |
| 24 | + protected $defaultViewObjectName = FusionView::class; |
| 25 | + |
| 26 | + public function indexAction(): void |
| 27 | + { |
| 28 | + $links = [ |
| 29 | + [ |
| 30 | + 'uuid' => '332c1ba3-d97b-407c-9e21-32a178d6d2e6', |
| 31 | + 'domain' => 'meine-neos-webseite.at', |
| 32 | + 'source' => '/unterseite', |
| 33 | + 'target' => 'https://invalid-url.com/', |
| 34 | + 'error' => 'Not found (404)', |
| 35 | + 'foundAt' => new \DateTimeImmutable('07-06-2022 14:35'), |
| 36 | + ], |
| 37 | + [ |
| 38 | + 'uuid' => '332c1ba3-d97b-407c-9e21-32a178d6d2e7', |
| 39 | + 'domain' => 'meine-neos-webseite.at', |
| 40 | + 'source' => '/unterseite', |
| 41 | + 'target' => 'https://broken-url.com/', |
| 42 | + 'error' => 'Internal Server Error (500)', |
| 43 | + 'foundAt' => new \DateTimeImmutable('08-06-2022 15:11'), |
| 44 | + ], |
| 45 | + ]; |
| 46 | + |
| 47 | + $flashMessages = $this->controllerContext->getFlashMessageContainer()->getMessagesAndFlush(); |
| 48 | + |
| 49 | + $this->view->assignMultiple([ |
| 50 | + 'links' => $links, |
| 51 | + 'flashMessages' => $flashMessages, |
| 52 | + ]); |
| 53 | + } |
| 54 | + |
| 55 | + public function runAction(): void |
| 56 | + { |
| 57 | + $this->addFlashMessage('Hello from run action!'); |
| 58 | + $this->redirect('index'); |
| 59 | + } |
| 60 | + |
| 61 | + public function markAsDoneAction(): void |
| 62 | + { |
| 63 | + $this->addFlashMessage('Hello from markAsDone action!'); |
| 64 | + $this->redirect('index'); |
| 65 | + } |
| 66 | + |
| 67 | + public function ignoreAction(): void |
| 68 | + { |
| 69 | + $this->addFlashMessage('Hello from ignore action!'); |
| 70 | + $this->redirect('index'); |
| 71 | + } |
| 72 | +} |
0 commit comments