API / Minn\Support / Markers

Markers final class

Minn\Support\Markers · public/minn/src/Minn/Support/Markers.php · 59 lines

The BEGIN/END marker blocks insert_with_markers() maintains in files like .htaccess: the captured shape keeps everything outside the markers, replaces the block inside them, and writes the reference's four-line do-not-edit preamble ahead of the inserted lines.

Public

staticwrite(string $file, string $marker, array $lines): bool#

Replaces the lines between a marker's begin and end comments in a file.

$lineslist<string>
staticread(string $file, string $marker): array#

The lines between a marker's begin and end comments, every block of it in order. A line opens or closes a block when it contains the comment anywhere (case-sensitive); lines that start with "#" are left out, so the preamble and any nested markers are, while indented comments stay. Lines split on "\n" only, and a block left open at the end of the file keeps the empty line after its final newline.

@return list<string>