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