/** * @covers ::findString * @dataProvider providerFindString */ public function testFindString($needle, $reverse, $expected) { if (stripos($expected, "Framework_Error") !== false) { $this->setExpectedException($expected); } $arr = ["headzoo", "joe", "sam", "sam", "666", "headzoo", 3.14, "joe"]; $this->assertEquals($expected, Arrays::findString($arr, $needle, $reverse)); }
/** * Stops handling an uncaught exception * * Tells the class to stop handling the given type of exception, which may be either * a class name, or object. Returns true if the exception type has been successfully * unhandled. A false return value means the class wasn't handling the given * exception. * * Uses the currently running environment when none is given. * * Examples: * ```php * $handler->removeUncaughtException(LogicError::class); * * $handler->removeUncaughtException("live", LogicError::class); * * $handler->removeUncaughtException("dev", InvalidArgumentException::class); * ``` * * @param string|Exception|string $env Name of the environment * @param Exception|string|null $exception The exception to check * * @return bool */ public function removeUncaughtException($env, $exception = null) { $this->swapArgs($env, $exception, $this->running_env); $is_removed = false; if (isset($this->exceptions[$env])) { $exception = Objects::getFullName($exception); $is_removed = (bool) Arrays::remove($this->exceptions[$env], $exception); } return $is_removed; }