Example #1
0
 public function path($path)
 {
     if (empty($path)) {
         Exception::raise('path is not defined', 2);
     } elseif (!preg_match('~^(\\/(.*?)\\/|re\\:#\\^/(.*?)/#([imsxADSUXju]+))$~', $path)) {
         Exception::raise('missing slash in "' . $path . '", use like this /foo/', 2);
     }
     $this->path = $path;
     return $this;
 }
Example #2
0
 /**
  * Raise an exception as a string.
  *
  * @param   bool    $previous    Whether raise previous exception if exists.
  * @return  string
  */
 public function raise($previous = false)
 {
     $out = parent::raise($previous);
     if (0 >= count($this)) {
         return $out;
     }
     $out .= "\n\n" . 'Contains the following exceptions:';
     foreach ($this as $exception) {
         $out .= "\n\n" . '  • ' . str_replace("\n", "\n" . '    ', $exception->raise($previous));
     }
     return $out;
 }