/** * Set maximum depth of this diagnostic context. If the current * depth is smaller or equal to <var>maxDepth</var>, then no * action is taken. * * <p>This method is a convenient alternative to multiple * {@link pop()} calls. Moreover, it is often the case that at * the end of complex call sequences, the depth of the NDC is * unpredictable. The {@link setMaxDepth()} method circumvents * this problem. * * @param integer $maxDepth * @see getDepth() */ public static function setMaxDepth($maxDepth) { $maxDepth = (int) $maxDepth; if (Payone_Log4php_LoggerNDC::getDepth() > $maxDepth) { self::$stack = array_slice(self::$stack, 0, $maxDepth); } }