TYPO3 CMS  TYPO3_6-2
Status.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Reports;
3 
21 class Status {
22 
23  const NOTICE = -2;
24  const INFO = -1;
25  const OK = 0;
26  const WARNING = 1;
27  const ERROR = 2;
31  protected $title;
32 
36  protected $value;
37 
41  protected $message;
42 
46  protected $severity;
47 
60  public function __construct($title, $value, $message = '', $severity = self::OK) {
61  $this->title = (string) $title;
62  $this->value = (string) $value;
63  $this->message = (string) $message;
64  $this->severity = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($severity, self::NOTICE, self::ERROR, self::OK);
65  }
66 
72  public function getTitle() {
73  return $this->title;
74  }
75 
81  public function getValue() {
82  return $this->value;
83  }
84 
90  public function getMessage() {
91  return $this->message;
92  }
93 
99  public function getSeverity() {
100  return $this->severity;
101  }
102 
108  public function __toString() {
109  $severity = array(
110  self::NOTICE => 'NOTE',
111  self::INFO => 'INFO',
112  self::OK => 'OK',
113  self::WARNING => 'WARN',
114  self::ERROR => 'ERR'
115  );
116  // Max length 80 characters
117  $stringRepresentation = str_pad(('[' . $severity[$this->severity] . ']'), 7) . str_pad($this->title, 40) . ' - ' . substr($this->value, 0, 30);
118  return $stringRepresentation;
119  }
120 
121 }
__construct($title, $value, $message='', $severity=self::OK)
Definition: Status.php:60
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:32