precision = $precision; } /** * @param LoggerLoggingEvent $event * @return string * @abstract */ public function getFullyQualifiedName($event) { // abstract return; } /** * @param LoggerLoggingEvent $event * @return string */ function convert($event) { $n = $this->getFullyQualifiedName($event); if($this->precision <= 0) { return $n; } else { $len = strlen($n); // We substract 1 from 'len' when assigning to 'end' to avoid out of // bounds exception in return r.substring(end+1, len). This can happen if // precision is 1 and the category name ends with a dot. $end = $len -1 ; for($i = $this->precision; $i > 0; $i--) { $end = strrpos(substr($n, 0, ($end - 1)), '.'); if($end == false) { return $n; } } return substr($n, ($end + 1), $len); } } }