Files
iblogs/src/Filter/LimitBytesFilter.php
indifferentketchup 4aeebf3732 refactor: rename Aternos\Mclogs to IndifferentKetchup\Iblogs
Bulk substitution across all PHP files in src/, build.php, worker.php,
and web/frontend/. Updates composer.json's package name and PSR-4
autoload root accordingly. Casing matches the existing
IndifferentKetchup\Codex package's namespace convention (capital K).

Strictly a namespace rename. Aternos\Codex\* imports remain in place;
those get re-pointed in a follow-up commit when the codex Composer
dependency itself is swapped. Filename renames (docker/mclogs.ini,
web/public/css/mclogs.css), README walk-through, env-var prefix changes,
and visible-text branding land in subsequent commits.
2026-05-01 22:11:13 +00:00

41 lines
880 B
PHP

<?php
namespace IndifferentKetchup\Iblogs\Filter;
use IndifferentKetchup\Iblogs\Config\Config;
use IndifferentKetchup\Iblogs\Config\ConfigKey;
class LimitBytesFilter extends Filter
{
/**
* Filter the $data string and return it
*
* Cuts the length down to maxLength
*
* @param string $data
* @return string
*/
public function filter(string $data): string
{
$lengthLimit = Config::getInstance()->get(ConfigKey::STORAGE_LIMIT_BYTES);
return mb_strcut($data, 0, $lengthLimit);
}
/**
* @return FilterType
*/
public function getType(): FilterType
{
return FilterType::LIMIT_BYTES;
}
/**
* @return array
*/
public function getData(): array
{
return [
"limit" => Config::getInstance()->get(ConfigKey::STORAGE_LIMIT_BYTES)
];
}
}