[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/uiexample/examples/ -> PhabricatorErrorExample.php (source)

   1  <?php
   2  
   3  final class PhabricatorErrorExample extends PhabricatorUIExample {
   4  
   5    public function getName() {
   6      return 'Errors';
   7    }
   8  
   9    public function getDescription() {
  10      return hsprintf(
  11        'Use <tt>AphrontErrorView</tt> to render errors, warnings and notices.');
  12    }
  13  
  14    public function renderExample() {
  15      $request = $this->getRequest();
  16      $user = $request->getUser();
  17  
  18      $sevs = array(
  19        AphrontErrorView::SEVERITY_ERROR    => 'Error',
  20        AphrontErrorView::SEVERITY_WARNING  => 'Warning',
  21        AphrontErrorView::SEVERITY_NOTICE   => 'Notice',
  22        AphrontErrorView::SEVERITY_NODATA   => 'No Data',
  23      );
  24  
  25      $views = array();
  26      foreach ($sevs as $sev => $title) {
  27        $view = new AphrontErrorView();
  28        $view->setSeverity($sev);
  29        $view->setTitle($title);
  30        $view->appendChild('Several issues were encountered.');
  31        $view->setErrors(
  32          array(
  33            'Overcooked.',
  34            'Too much salt.',
  35            'Full of sand.',
  36          ));
  37        $views[] = $view;
  38      }
  39  
  40      return $views;
  41    }
  42  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1