‪TYPO3CMS  ‪main
Message.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 
24 {
30  protected ‪$message = 'Unknown message';
31 
37  protected ‪$code;
38 
44  protected ‪$arguments = [];
45 
51  protected ‪$title = '';
52 
61  public function ‪__construct(string ‪$message, int ‪$code, array ‪$arguments = [], string ‪$title = '')
62  {
63  $this->message = ‪$message;
64  $this->code = ‪$code;
65  $this->arguments = ‪$arguments;
66  $this->title = ‪$title;
67  }
68 
74  public function ‪getMessage(): string
75  {
76  return ‪$this->message;
77  }
78 
84  public function ‪getCode(): int
85  {
86  return ‪$this->code;
87  }
88 
92  public function ‪getArguments(): array
93  {
94  return ‪$this->arguments;
95  }
96 
100  public function ‪getTitle(): string
101  {
102  return ‪$this->title;
103  }
104 
108  public function ‪render(): string
109  {
110  if (count($this->arguments) > 0) {
111  return vsprintf($this->message, $this->arguments);
112  }
113  return ‪$this->message;
114  }
115 
121  public function ‪__toString()
122  {
123  return $this->‪render();
124  }
125 }
‪TYPO3\CMS\Extbase\Error\Message\__toString
‪string __toString()
Definition: Message.php:117
‪TYPO3\CMS\Extbase\Error\Message\getCode
‪int getCode()
Definition: Message.php:80
‪TYPO3\CMS\Extbase\Error\Message\render
‪render()
Definition: Message.php:104
‪TYPO3\CMS\Extbase\Error
Definition: Error.php:18
‪TYPO3\CMS\Extbase\Error\Message
Definition: Message.php:24
‪TYPO3\CMS\Extbase\Error\Message\$arguments
‪array $arguments
Definition: Message.php:41
‪TYPO3\CMS\Extbase\Error\Message\getMessage
‪string getMessage()
Definition: Message.php:70
‪TYPO3\CMS\Extbase\Error\Message\$message
‪string $message
Definition: Message.php:29
‪TYPO3\CMS\Extbase\Error\Message\$title
‪string $title
Definition: Message.php:47
‪TYPO3\CMS\Extbase\Error\Message\getArguments
‪getArguments()
Definition: Message.php:88
‪TYPO3\CMS\Extbase\Error\Message\getTitle
‪getTitle()
Definition: Message.php:96
‪TYPO3\CMS\Extbase\Error\Message\$code
‪int $code
Definition: Message.php:35
‪TYPO3\CMS\Extbase\Error\Message\__construct
‪__construct(string $message, int $code, array $arguments=[], string $title='')
Definition: Message.php:57