<?php
class Wyjatek
{
function __construct(string $message = NULL, int $code = NULL)
{
{
$this->message = $message;
}
$this->code = $code;
$this->file = __FILE__;
$this->line = __LINE__;
$this->string = StringFormat($this);
}
protected $message = 'Nieznany błąd krytyczny';
protected $code = 0;
protected $file;
protected $line;
private $trace;
private $string;
final function getMessage()
{
return $this->message;
}
final function getCode()
{
return $this->code;
}
final function getFile()
{
return $this->file;
}
final function getLine()
{
return $this->line;
}
final function getTrace()
{
return $this->trace;
}
final function getTraceAsString()
{
return self::TraceFormat($this);
}
function __toString()
{
return '<table>
<tr>
<td><strong>' . $this->getCode() . '</strong>: ' . $this->getMessage() . '<br /></td>
<td>Nastąpił w pliku ' . $this->getFile(). ' w lini ' . $this->getLine() . '</td></tr></table>';
}
static private function StringFormat
(Exception
$exception) {
//
//
}
static private function TraceFormat
(Exception
$exception) {
//
//
}
}
try
{
throw new Wyjatek('Wystąpił błąd krytyczny', 2);
}
catch(Wyjatek $ee)
{
}
?>
Powoduje to Fatalny Błąd:
Kod
[b]Fatal error[/b]: Argument 1 passed to Wyjatek::__construct() must be an object of class string, called in D:\WebServer\httpd\index.php on line 168 and defined in [b]D:\WebServer\httpd\index.php[/b] on line [b]91
[/b]Liniami kodu proszę się nie przejmować, wszystko jest zaznaczone jako komenatrze. Nie wiem dlaczego tak się dzieje [chodzi o błąd].
Proszę o pomoc w tej kwestii z góry pięknie dziękuję.
Pozdrowionka