‪TYPO3CMS  11.5
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 
94  public function ‪getArguments(): array
95  {
96  return ‪$this->arguments;
97  }
98 
104  public function ‪getTitle(): string
105  {
106  return ‪$this->title;
107  }
108 
114  public function ‪render(): string
115  {
116  if (count($this->arguments) > 0) {
117  return vsprintf($this->message, $this->arguments);
118  }
119  return ‪$this->message;
120  }
121 
127  public function ‪__toString()
128  {
129  return $this->‪render();
130  }
131 }
‪TYPO3\CMS\Extbase\Error\Message\__toString
‪string __toString()
Definition: Message.php:123
‪TYPO3\CMS\Extbase\Error\Message\getCode
‪int getCode()
Definition: Message.php:80
‪TYPO3\CMS\Extbase\Error\Message\render
‪string render()
Definition: Message.php:110
‪TYPO3\CMS\Extbase\Error\Message\getTitle
‪string getTitle()
Definition: Message.php:100
‪TYPO3\CMS\Extbase\Error
Definition: Error.php:18
‪TYPO3\CMS\Extbase\Error\Message
Definition: Message.php:24
‪TYPO3\CMS\Extbase\Error\Message\getArguments
‪array getArguments()
Definition: Message.php:90
‪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\$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