/** * @covers ::merge * @expectedException Headzoo\Core\Exceptions\InvalidArgumentException */ public function testMerge_Invalid2() { $obj_a = new stdClass(); $obj_b = 42; /** @noinspection PhpParamsInspection */ Objects::merge($obj_a, $obj_b); }
/** * Returns whether the given exception is being handled * * Returns true when the given exception is one of the exceptions being handled for * the given running environment. Otherwise false is returned. The $exception * argument can be a class name or object. * * Uses the currently running environment when none is given. * * Examples: * ```php * $is_handled = $handler->isHandlingUncaughtException(LogicException::class); * * $is_handled = $handler->isHandlingUncaughtException("live", LogicException::class); * ``` * * @param string|int $env The environment to check * @param string|Exception|null $exception The exception to check * * @return bool */ public function isHandlingUncaughtException($env, $exception = null) { $this->swapArgs($env, $exception, $this->running_env); $is_handling = false; if (isset($this->exceptions[$env])) { if (is_object($exception)) { $exception = Objects::getFullName($exception); } foreach ($this->exceptions[$env] as $e) { if (is_subclass_of($exception, $e) || $exception == $e) { $is_handling = true; break; } } } return $is_handling; }