TYPO3 CMS  TYPO3_6-2
StatusUtility.php
Go to the documentation of this file.
1 <?php
3 
22 
30  public function sortBySeverity(array $statusObjects = array()) {
31  $orderedStatus = array(
32  'alert' => $this->filterBySeverity($statusObjects, 'alert'),
33  'error' => $this->filterBySeverity($statusObjects, 'error'),
34  'warning' => $this->filterBySeverity($statusObjects, 'warning'),
35  'ok' => $this->filterBySeverity($statusObjects, 'ok'),
36  'information' => $this->filterBySeverity($statusObjects, 'information'),
37  'notice' => $this->filterBySeverity($statusObjects, 'notice'),
38  );
39  return $orderedStatus;
40  }
41 
50  public function filterBySeverity(array $statusObjects = array(), $severity = 'ok') {
51  $filteredObjects = array();
53  foreach ($statusObjects as $status) {
54  if (!$status instanceof StatusInterface) {
55  throw new Exception(
56  'Object must implement StatusInterface',
57  1366919442
58  );
59  }
60  if ($status->getSeverity() === $severity) {
61  $filteredObjects[] = $status;
62  }
63  }
64  return $filteredObjects;
65  }
66 }
sortBySeverity(array $statusObjects=array())