diff --git a/inc/PhpObject.php b/inc/PhpObject.php index 36e6141..51a9627 100644 --- a/inc/PhpObject.php +++ b/inc/PhpObject.php @@ -96,6 +96,12 @@ class PhpObject $this->addMessage(self::ERROR_TAB, $sError); } + protected function throwError(string $sError): never + { + $this->addError($sError); + throw new \RuntimeException($sError); + } + private function addMessage($sType, $sMessage) { $this->asMessageStack[$sType][] = array('msg'=>$sMessage, 'time'=>date('d.m.Y H:i:s'), 'type'=>$sType, 'location'=>$this->sChildClass); @@ -194,4 +200,4 @@ class PhpObject { $this->cleanMessageStack(); } -} \ No newline at end of file +}