class Exception {
function __construct(string $message=NULL, int $code=0) {
$this->message = $message;
}
$this->code = $code;
$this->file = __FILE__; // dla klauzuli throw
$this->line = __LINE__; // dla klauzuli throw
$this->string = StringFormat($this);
}
protected $message = "Unknown exception"; // komunikat wyjątku
protected $code = 0; // kod wyjątku definiowany przez użytkownika
protected $file; // nazwa pliku źródłowego z wyjątkiem
protected $line; // numer wiersza z wyjątkiem
private $trace; // stos wywołań w momencie wyst. wyjątku
private $string; // wykorzystywana wewnętrznie!!
final function getMessage(){
return $this->message;
}
final function getCode() {
return $this->code;
}
final function getFile() {
return $this->file;
}
final function getTrace() {
return $this->trace;
}
final function getTraceAsString() {
return self::TraceFormat($this);
}
function _toString() {
return $this->string;
}
static private function StringFormat
(Exception
$exception) { // ... funkcja niedostepna w skryptach PHP
// zwraca wszystkie informacje w postaci ciagu
}
static private function TraceFormat
(Exception
$exception) { // ... funkcja niedostepna w skryptach PHP
// zwraca zapis stosu wywolan w postaci ciagu
}
}
Po wywołaniu tego kodu wyrzuca mi błąd :
Fatal error: Default value for parameters with a class type hint can only be NULL in C:\wamp\www\bigos\tbl\tbl.php on line 2. Mogłby mi ktoś powiedzieć co tu jest źle ??Pomijając to ze w ogole tego kodu nie rozumiem, ponieważ jest on z nowego tematu który właśnie zacząłem.