29 lines
805 B
PHP
29 lines
805 B
PHP
<?php
|
|
|
|
// Router de compatibilidad del paquete text (inyectado en src/Routers/Compat.php
|
|
// por scripts/compat-sweep). Ejercita Filter y Replacement sobre el arranque
|
|
// real del core (Loader -> Router::apply()).
|
|
|
|
use Libs\Filter;
|
|
use Libs\Replacement;
|
|
use Libs\Router;
|
|
|
|
Router::get('/compat/text/filter', function () {
|
|
Filter::add(
|
|
fn (string $content): string => str_replace('mundo', 'MUNDIN', $content),
|
|
'compat',
|
|
5
|
|
);
|
|
Filter::add(
|
|
fn (string $content): string => strtoupper($content) . '|',
|
|
'compat',
|
|
20
|
|
);
|
|
echo 'FILTER_OK:' . Filter::apply('hola mundo', 'compat');
|
|
});
|
|
|
|
Router::get('/compat/text/replacement', function () {
|
|
Replacement::add('/\bfoo\b/', 'bar');
|
|
echo 'REPL_OK:' . Replacement::apply('foo y food y foo');
|
|
});
|