Rename the top-level lib/ directory to core/ so the project root immediately communicates which code is core platform and which lives in modules/. PHP namespaces (MintyPHP\*) are unchanged — only the Composer PSR-4 path mapping moves from lib/ to core/. Module-internal lib/ directories (modules/*/lib/) are untouched. Updated across the full stack: - composer.json PSR-4 mapping - bootstrap entry points (web/index.php, bin/*, tests/bootstrap.php) - tooling configs (phpstan.neon, phpunit.xml, php-cs-fixer) - 26 architecture contract tests - enforcement-policy, guard-catalog, quality-gates - all documentation (CLAUDE.md, README, 25 docs/, .agents/skills/) - bin/qa-extended.sh search paths - .claude/settings.local.json permission paths Workflow: .agents/runs/CORE-LIB-RENAME-001/ (Analyst → Planner → Executor → Code Review (4 findings fixed) → Security Review → Acceptance Test → Finalizer) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Translate the first argument and optionally run sprintf placeholders.
|
|
*/
|
|
function t()
|
|
{
|
|
$arguments = func_get_args();
|
|
$arguments[0] = \MintyPHP\I18n::translate($arguments[0]);
|
|
if (count($arguments) === 1) {
|
|
return $arguments[0];
|
|
}
|
|
return call_user_func_array('sprintf', $arguments);
|
|
}
|
|
|
|
/**
|
|
* Format a UTC timestamp for display in the configured app timezone.
|
|
*/
|
|
function dt($value, ?string $format = null)
|
|
{
|
|
$displayTz = null;
|
|
try {
|
|
$displayTz = new \DateTimeZone(defined('APP_TIMEZONE') ? APP_TIMEZONE : date_default_timezone_get());
|
|
} catch (\Exception $e) {
|
|
$displayTz = new \DateTimeZone(date_default_timezone_get());
|
|
}
|
|
|
|
if ($value instanceof \DateTimeInterface) {
|
|
$date = (new \DateTimeImmutable('@' . $value->getTimestamp()))->setTimezone($displayTz);
|
|
} elseif (is_string($value) && $value !== '') {
|
|
try {
|
|
// Treat DB timestamps as UTC and convert for display
|
|
$date = new \DateTimeImmutable($value, new \DateTimeZone('UTC'));
|
|
$date = $date->setTimezone($displayTz);
|
|
} catch (\Exception $e) {
|
|
return $value;
|
|
}
|
|
} else {
|
|
return '';
|
|
}
|
|
|
|
if ($format === null) {
|
|
$locale = \MintyPHP\I18n::$locale ?? '';
|
|
$format = (strpos((string) $locale, 'de') === 0) ? 'd.m.Y H:i' : 'Y-m-d H:i';
|
|
}
|
|
|
|
return $date->format($format);
|
|
}
|