implement Code::escaped method

This commit is contained in:
yggverse 2024-06-23 15:05:12 +03:00
parent 63d810b9fe
commit 1cd973f9a0

23
src/Code.php Normal file
View file

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Yggverse\Gemtext;
class Code
{
/*
* Helper method
*
* Detect line given is escaped by previous iteration
*/
public static function escaped(string $line, bool &$status): bool
{
if (preg_match('/^```/m', $line))
{
$status = !($status); // toggle
}
return $status;
}
}