public function __construct($filename, $mode = 'read', array $paths = null)
 {
     switch ($mode) {
         case 'read':
             $m = "was not found";
             break;
         case 'write':
             $m = "can't be written to";
             break;
         case 'delete':
             $m = "can't be deleted";
             break;
         default:
             throw new \RuntimeException("Invalid mode {$mode}.");
     }
     $extra = $paths ? sprintf("<p>The file was searched for at:<ul>%s</ul>", implode('', map($paths, function ($p) use($filename) {
         return "<li><pre>{$p}/{$filename}</pre>";
     }))) : '';
     parent::__construct("File '<kbd>{$filename}</kbd>' {$m}.{$extra}");
 }
 public function __construct($msg, $body = null, $start = null, $end = null)
 {
     $b = $start > self::CONTEXT_LENGTH ? $start - self::CONTEXT_LENGTH : 0;
     $e = $end + self::CONTEXT_LENGTH;
     if ($e >= strlen($body)) {
         $e = strlen($body);
     }
     if (isset($body)) {
         $tag = substr($body, $start, $end - $start + 1);
         $body = substr_replace($body, "<%{$tag}%>", $start, strlen($tag));
         $lines = explode("\n", substr($body, $b, $e - $b));
         array_pop($lines);
         array_shift($lines);
         $code = implode("\n", $lines);
         $code = htmlentities($code, null, 'utf-8');
         $code = preg_replace('/&lt;.*?&gt;/s', '<span class="tag">$0</span>', $code);
         $code = preg_replace('/&lt;%(.*?)%&gt;/s', '<span class="tag-hilight">$1</span>', $code);
         $msg .= "<h4>Error location:</h4><code>{$code}</code>";
     }
     parent::__construct($msg, 'Parsing error');
 }
 public function __construct($msg)
 {
     parent::__construct($msg, 'Databinding error');
 }