src/StreamLogger.php
private function replaceContext(string $format, array $context): string {
        $msg = preg_replace_callback('`({[^\s{}]+})`', function ($m) use ($context) {
            $field = trim($m[1], '{}');
            if (array_key_exists($field, $context)) {
                return $context[$field];
            } else {
                return $m[1];
            }
        }, $format);
        return $msg;
    }
private function replaceContext(string $format, array $context): string {
        $msg = preg_replace_callback('`({[^\s{}]+})`', function ($m) use ($context) {
            $field = trim($m[1], '{}');
            if (array_key_exists($field, $context)) {
                return $context[$field];
            } else {
                return $m[1];
            }
        }, $format);
        return $msg;
    }
private function replaceContext ( string $ format , array $ context ) : string { $ msg = preg_replace_callback ( '`({[^\s{}]+})`' , function ( $ m ) use ( $ context ) { $ field = trim ( $ m [ 1 ] , '{}' ) ; if ( array_key_exists ( $ field , $ context ) ) { return $ context [ $ field ] ; } else { return $ m [ 1 ] ; } } , $ format ) ; return $ msg ; }
Replace a message format with context information.

The message format contains fields wrapped in curly braces.

@param string $format The message format to replace.
@param array $context The context data.
@return string Returns the formatted message.
Replace a message format with context information .