1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-02-24 06:52:34 +01:00

Use array_replace instead of manually looping through items

This commit is contained in:
Jordi Boggiano 2013-07-30 13:01:58 +02:00
parent f72392d0e6
commit b33357d16b

View File

@ -81,12 +81,7 @@ class ErrorHandler
public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1)
{
$prev = set_error_handler(array($this, 'handleError'), $errorTypes);
$this->errorLevelMap = $this->defaultErrorLevelMap();
// merging the map into the defaults by hand because array_merge
// trips up on numeric keys
foreach ($levelMap as $key => $val) {
$this->errorLevelMap[$key] = $val;
}
$this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap);
if ($callPrevious) {
$this->previousErrorHandler = $prev ?: true;
}