‪TYPO3CMS  10.4
Status.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
16 namespace ‪TYPO3\CMS\Reports;
17 
19 
23 class ‪Status
24 {
25  const ‪NOTICE = -2;
26  const ‪INFO = -1;
27  const ‪OK = 0;
28  const ‪WARNING = 1;
29  const ‪ERROR = 2;
30 
34  protected ‪$title;
35 
39  protected ‪$value;
40 
44  protected ‪$message;
45 
49  protected ‪$severity;
50 
63  public function ‪__construct(‪$title, ‪$value, ‪$message = '', ‪$severity = self::OK)
64  {
65  $this->title = (string)‪$title;
66  $this->value = (string)‪$value;
67  $this->message = (string)‪$message;
68  $this->severity = ‪MathUtility::forceIntegerInRange(‪$severity, self::NOTICE, self::ERROR, self::OK);
69  }
70 
76  public function ‪getTitle()
77  {
78  return ‪$this->title;
79  }
80 
86  public function ‪getValue()
87  {
88  return ‪$this->value;
89  }
90 
96  public function ‪getMessage()
97  {
98  return ‪$this->message;
99  }
100 
106  public function ‪getSeverity()
107  {
108  return ‪$this->severity;
109  }
110 
116  public function ‪__toString()
117  {
118  ‪$severity = [
119  self::NOTICE => 'NOTE',
120  self::INFO => 'INFO',
121  self::OK => 'OK',
122  self::WARNING => 'WARN',
123  self::ERROR => 'ERR'
124  ];
125  // Max length 80 characters
126  $stringRepresentation = str_pad('[' . ‪$severity[$this->severity] . ']', 7) . str_pad($this->title, 40) . ' - ' . substr($this->value, 0, 30);
127  return $stringRepresentation;
128  }
129 }
‪TYPO3\CMS\Reports\Status\getSeverity
‪int getSeverity()
Definition: Status.php:102
‪TYPO3\CMS\Reports\Status\NOTICE
‪const NOTICE
Definition: Status.php:25
‪TYPO3\CMS\Reports\Status\ERROR
‪const ERROR
Definition: Status.php:29
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:32
‪TYPO3\CMS\Reports\Status\getMessage
‪string getMessage()
Definition: Status.php:92
‪TYPO3\CMS\Reports\Status\__construct
‪__construct($title, $value, $message='', $severity=self::OK)
Definition: Status.php:59
‪TYPO3\CMS\Reports\Status\OK
‪const OK
Definition: Status.php:27
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Reports\Status\$severity
‪int $severity
Definition: Status.php:45
‪TYPO3\CMS\Reports\Status\WARNING
‪const WARNING
Definition: Status.php:28
‪TYPO3\CMS\Reports
‪TYPO3\CMS\Reports\Status\__toString
‪string __toString()
Definition: Status.php:112
‪TYPO3\CMS\Reports\Status\INFO
‪const INFO
Definition: Status.php:26
‪TYPO3\CMS\Reports\Status\getValue
‪string getValue()
Definition: Status.php:82
‪TYPO3\CMS\Reports\Status\$title
‪string $title
Definition: Status.php:33
‪TYPO3\CMS\Reports\Status\$value
‪string $value
Definition: Status.php:37
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:22
‪TYPO3\CMS\Reports\Status\getTitle
‪string getTitle()
Definition: Status.php:72
‪TYPO3\CMS\Reports\Status\$message
‪string $message
Definition: Status.php:41