add caller info to log when a bad argument is passed to event constructor

This commit is contained in:
Isaac Connor 2016-10-12 15:38:40 -04:00
parent bf4bbf8b8d
commit 3baa64aa52
1 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,10 @@ class Event {
} elseif ( is_array( $IdOrRow ) ) {
$row = $IdOrRow;
} else {
$backTrace = debug_backtrace();
$file = $backTrace[1]['file'];
$line = $backTrace[1]['line'];
Error("Unknown argument passed to Event Constructor from $file:$line)");
Error("Unknown argument passed to Event Constructor ($IdOrRow)");
return;
}
@ -30,6 +34,9 @@ class Event {
public function Storage() {
return new Storage( isset($this->{'StorageId'}) ? $this->{'StorageId'} : NULL );
}
public function Monitor() {
return new Monitor( isset($this->{'MonitorId'}) ? $this->{'MonitorId'} : NULL );
}
public function __call( $fn, array $args){
if ( array_key_exists( $fn, $this ) ) {
return $this->{$fn};