Documentation

Context
in package

FinalYes

Log context utility class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Methods

sanitize()  : string
Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).
serialize()  : string
Serialize a context array (minus timestamp/name/format) as text, JSON, or PHP-serialized, depending on context['format']

Methods

sanitize()

Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).

public static sanitize(string $value) : string
Parameters
$value : string
Return values
string

serialize()

Serialize a context array (minus timestamp/name/format) as text, JSON, or PHP-serialized, depending on context['format']

public static serialize(array<string|int, mixed> $context) : string
Parameters
$context : array<string|int, mixed>
Return values
string

        
On this page

Search results