[BUGFIX] Prematurely end data array processing on invalid item
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Typolink / UnableToLinkException.php
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
18 namespace TYPO3\CMS\Frontend\Typolink;
19
20 use TYPO3\CMS\Frontend\Exception;
21
22 /**
23 * Exception which is thrown when a link could not be set
24 */
25 class UnableToLinkException extends Exception
26 {
27 /**
28 * @var string the text which should have gone inside the
29 */
30 protected $linkText;
31
32 /**
33 * Constructor the exception. With an additional parameter for the link text
34 *
35 * @param string $message [optional] The Exception message to throw.
36 * @param int $code [optional] The Exception code.
37 * @param \Throwable $previous [optional] The previous throwable used for the exception chaining.
38 * @param string $linkText [optional]
39 */
40 public function __construct($message = '', $code = 0, \Throwable $previous = null, $linkText = '')
41 {
42 parent::__construct($message, $code, $previous);
43 $this->linkText = $linkText;
44 }
45
46 /**
47 * Returns the link text when the link could not been set
48 *
49 * @return string
50 */
51 public function getLinkText(): string
52 {
53 return $this->linkText;
54 }
55 }