16 lines
341 B
PHP
16 lines
341 B
PHP
<?php
|
|
|
|
namespace App\Service\SnipContent;
|
|
|
|
class Lexer
|
|
{
|
|
public static function tokenize(string $text): array {
|
|
$text = str_replace("\r", '', $text);
|
|
return explode(PHP_EOL, $text);
|
|
}
|
|
|
|
public static function reconstruct(array $tokens): string
|
|
{
|
|
return implode(PHP_EOL, $tokens);
|
|
}
|
|
} |