r
This commit is contained in:
@@ -22,66 +22,76 @@ class Component implements Configure
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* BaseAbstract constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* BaseAbstract constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function className(): string
|
||||
{
|
||||
return static::class;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function className(): string
|
||||
{
|
||||
return static::class;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __get(string $name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return $this->{$method}();
|
||||
} else if (method_exists($this, $name)) {
|
||||
return $this->{$name};
|
||||
} else {
|
||||
throw new Exception('Unable getting property ' . get_called_class() . '::' . $name);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return Kiri\Error\StdoutLogger
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function getLogger(): Kiri\Error\StdoutLogger
|
||||
{
|
||||
return Kiri::getLogger();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param $value
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __set(string $name, $value): void
|
||||
{
|
||||
$method = 'set' . ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->{$method}($value);
|
||||
} else if (method_exists($this, $name)) {
|
||||
$this->{$name} = $value;
|
||||
} else {
|
||||
throw new Exception('Unable setting property ' . get_called_class() . '::' . $name);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __get(string $name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return $this->{$method}();
|
||||
} else if (method_exists($this, $name)) {
|
||||
return $this->{$name};
|
||||
} else {
|
||||
throw new Exception('Unable getting property ' . get_called_class() . '::' . $name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param $value
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __set(string $name, $value): void
|
||||
{
|
||||
$method = 'set' . ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->{$method}($value);
|
||||
} else if (method_exists($this, $name)) {
|
||||
$this->{$name} = $value;
|
||||
} else {
|
||||
throw new Exception('Unable setting property ' . get_called_class() . '::' . $name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
namespace Kiri\Error;
|
||||
|
||||
use Closure;
|
||||
use ErrorException;
|
||||
use Exception;
|
||||
use Kiri;
|
||||
use Kiri\Abstracts\Component;
|
||||
@@ -18,6 +19,7 @@ use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use ReflectionException;
|
||||
use Kiri\Events\OnSystemError;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class ErrorHandler
|
||||
@@ -110,13 +112,13 @@ class ErrorHandler extends Component implements ErrorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param \Throwable $exception
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function exceptionHandler(\Throwable $exception): void
|
||||
public function exceptionHandler(Throwable $exception): void
|
||||
{
|
||||
$this->category = 'exception';
|
||||
|
||||
@@ -127,7 +129,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @throws \ErrorException
|
||||
* @throws ErrorException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ReflectionException
|
||||
@@ -136,8 +138,10 @@ class ErrorHandler extends Component implements ErrorInterface
|
||||
{
|
||||
$error = func_get_args();
|
||||
|
||||
var_dump($error);
|
||||
|
||||
event(new OnSystemError());
|
||||
|
||||
throw new \ErrorException($error[1], $error[0], 1, $error[2], $error[3]);
|
||||
throw new ErrorException($error[1], $error[0], 1, $error[2], $error[3]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user