예제 #1
0
 public function testInstantiation()
 {
     $exception = new NotFound(9, [1, 2, 3]);
     $this->assertEquals('Not Found', $exception->getMessage());
     $this->assertEquals(404, $exception->getStatusCode());
     $this->assertEquals(9, $exception->getCode());
     $this->assertEquals([1, 2, 3], $exception->getDetails());
 }
예제 #2
0
 /**
  * Create a new decorator not found exception.
  *
  * @param string      $class
  * @param string|null $message
  *
  * @return void
  */
 public function __construct($class, $message = null)
 {
     if (!$message) {
         $message = "The decorator class '{$class}' was not found.";
     }
     parent::__construct($class, $message);
 }
예제 #3
0
 /**
  * Create a new method not found exception.
  *
  * @param string      $class
  * @param string      $method
  * @param string|null $message
  *
  * @return void
  */
 public function __construct($class, $method, $message = null)
 {
     $this->method = $method;
     if (!$message) {
         $message = "The method '{$method}' was not found on the presenter class '{$class}'.";
     }
     parent::__construct($class, $message);
 }
예제 #4
0
 /**
  * Called when the exception is constructed
  *
  * @param  string[]  $properties  the exception's properties
  * @return  self
  * @throws  InvalidArgumentException  if $names is neither a string nor array
  * @since  0.1.0
  */
 public function __construct($names)
 {
     parent::__construct($names);
     if (count($this->names) === 1) {
         $this->message = "Property {$this->names[0]} could not be found";
     } else {
         $this->message = "The following properties could not be found: " . implode(', ', $this->names);
     }
     return;
 }
예제 #5
0
파일: Index.class.php 프로젝트: rolwi/koala
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     header("HTTP/1.0 404 Not Found");
     $content = \NotFound::getInstance()->loadTemplate("404-inline.template.html");
     $content->setVariable("TITLE", "Endstation Hbf");
     $content->setVariable("MESSAGE", "Sie haben das Ende erreicht. Hier war noch niemand zuvor. Nicht mal wir Entwickler.<br/><br/><a href=\"javascript:history.back();\">Der einzige Weg führt zurück.</a>");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $rawHtml->setCss(\NotFound::getInstance()->readCss());
     $frameResponseObject->setTitle("Seite nicht gefunden (Fehler 404).");
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
예제 #6
0
파일: index.php 프로젝트: yemasky/my
 * email:yemasky@msn.com
 */
declare (strict_types=1);
try {
    require_once "config.php";
    $model = '\\www\\IndexAction';
    if (isset($_REQUEST['model'])) {
        $model = '\\www\\' . ucwords($_REQUEST['model']) . 'Action';
    }
    $action = NULL;
    if (isset($_REQUEST['action'])) {
        $action = $_REQUEST['action'];
    }
} catch (Exception $e) {
    echo 'error: ' . $e->getMessage() . "<br>";
    echo str_replace("\n", "\n<br>", $e->getTraceAsString());
}
try {
    $objAction = new $model();
    $objAction->execute($action);
} catch (Exception $e) {
    logError($e->getMessage(), __MODEL_EXCEPTION);
    logError($e->getTraceAsString(), __MODEL_EMPTY);
    if (__Debug) {
        echo 'error: ' . $e->getMessage() . "<br>";
        echo str_replace("\n", "\n<br>", $e->getTraceAsString());
    } else {
        $objAction = new NotFound();
        $objAction->execute();
    }
}
예제 #7
0
 /**
  * Constructor
  * 
  * @param string $file Filename
  * @param string $fileType File type
  * @param int $code Error code
  * @param \Exception $previous Previous Exception
  */
 public function __construct($file, $fileType, $code = 0, \Exception $previous = null)
 {
     parent::__construct('File ' . $file . ' [' . $fileType . ']', basename($file), $code, $previous);
 }
예제 #8
0
<?php

require_once '../../src/errors/NotFound.php';
require_once '../../src/errors/PermDenied.php';
switch ($_GET['co']) {
    case '403':
        $error = new PermDenied();
        break;
    case '404':
        $error = new NotFound();
        break;
    default:
        $error = new NotFound();
        break;
}
?>

<!DOCTYPE html>
<html>
<head>

	<meta charset="utf-8">
	<title><?php 
echo $error->getErrorPageTitle();
?>
</title>
	<meta name="web_author" content="Jan Jaroš, honziik.j@gmail.com">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="robots" content="noindex, nofollow">
	<meta name="googlebot" content="noindex, nofollow">