‪TYPO3CMS  10.4
BrokenLinkAnalysisEvent.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\EventDispatcher\StoppableEventInterface;
21 
25 final class ‪BrokenLinkAnalysisEvent implements StoppableEventInterface
26 {
31  private ‪$linkType;
32 
37  private ‪$linkData;
38 
42  private ‪$isBroken = false;
43 
47  private ‪$linkWasChecked = false;
48 
53  private ‪$reason = '';
54 
55  public function ‪__construct(string ‪$linkType, array ‪$linkData)
56  {
57  $this->linkType = ‪$linkType;
58  $this->linkData = ‪$linkData;
59  }
60 
61  public function ‪isPropagationStopped(): bool
62  {
63  // prevent other listeners from being called if link has been checked
65  }
66 
67  public function ‪getLinkType(): string
68  {
69  return ‪$this->linkType;
70  }
71 
72  public function ‪getLinkData(): array
73  {
74  return ‪$this->linkData;
75  }
76 
77  public function ‪markAsCheckedLink(): void
78  {
79  $this->linkWasChecked = true;
80  }
81 
82  public function ‪markAsBrokenLink(string ‪$reason = ''): void
83  {
84  $this->isBroken = true;
85  $this->reason = ‪$reason;
86  }
87 
88  public function ‪isBrokenLink(): bool
89  {
90  return ‪$this->isBroken;
91  }
92 
93  public function ‪getReason(): string
94  {
95  return ‪$this->reason;
96  }
97 }
‪TYPO3\CMS\Core\Html\Event
Definition: BrokenLinkAnalysisEvent.php:18