Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
142
vendor/symfony/translation/Util/ArrayConverter.php
vendored
Normal file
142
vendor/symfony/translation/Util/ArrayConverter.php
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Util;
|
||||
|
||||
/**
|
||||
* ArrayConverter generates tree like structure from a message catalogue.
|
||||
* e.g. this
|
||||
* 'foo.bar1' => 'test1',
|
||||
* 'foo.bar2' => 'test2'
|
||||
* converts to follows:
|
||||
* foo:
|
||||
* bar1: test1
|
||||
* bar2: test2.
|
||||
*
|
||||
* @author Gennady Telegin <gtelegin@gmail.com>
|
||||
*/
|
||||
class ArrayConverter
|
||||
{
|
||||
/**
|
||||
* Converts linear messages array to tree-like array.
|
||||
* For example: ['foo.bar' => 'value'] will be converted to ['foo' => ['bar' => 'value']].
|
||||
*
|
||||
* @param array $messages Linear messages array
|
||||
*/
|
||||
public static function expandToTree(array $messages): array
|
||||
{
|
||||
$tree = [];
|
||||
|
||||
foreach ($messages as $id => $value) {
|
||||
$referenceToElement = &self::getElementByPath($tree, self::getKeyParts($id));
|
||||
|
||||
$referenceToElement = $value;
|
||||
|
||||
unset($referenceToElement);
|
||||
}
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
private static function &getElementByPath(array &$tree, array $parts): mixed
|
||||
{
|
||||
$elem = &$tree;
|
||||
$parentOfElem = null;
|
||||
|
||||
foreach ($parts as $i => $part) {
|
||||
if (isset($elem[$part]) && \is_string($elem[$part])) {
|
||||
/* Process next case:
|
||||
* 'foo': 'test1',
|
||||
* 'foo.bar': 'test2'
|
||||
*
|
||||
* $tree['foo'] was string before we found array {bar: test2}.
|
||||
* Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2';
|
||||
*/
|
||||
$elem = &$elem[implode('.', \array_slice($parts, $i))];
|
||||
break;
|
||||
}
|
||||
|
||||
$parentOfElem = &$elem;
|
||||
$elem = &$elem[$part];
|
||||
}
|
||||
|
||||
if ($elem && \is_array($elem) && $parentOfElem) {
|
||||
/* Process next case:
|
||||
* 'foo.bar': 'test1'
|
||||
* 'foo': 'test2'
|
||||
*
|
||||
* $tree['foo'] was array = {bar: 'test1'} before we found string constant `foo`.
|
||||
* Cancel treating $tree['foo'] as array and cancel back it expansion,
|
||||
* e.g. make it $tree['foo.bar'] = 'test1' again.
|
||||
*/
|
||||
self::cancelExpand($parentOfElem, $part, $elem);
|
||||
}
|
||||
|
||||
return $elem;
|
||||
}
|
||||
|
||||
private static function cancelExpand(array &$tree, string $prefix, array $node): void
|
||||
{
|
||||
$prefix .= '.';
|
||||
|
||||
foreach ($node as $id => $value) {
|
||||
if (\is_string($value)) {
|
||||
$tree[$prefix.$id] = $value;
|
||||
} else {
|
||||
self::cancelExpand($tree, $prefix.$id, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private static function getKeyParts(string $key): array
|
||||
{
|
||||
$parts = explode('.', $key);
|
||||
$partsCount = \count($parts);
|
||||
|
||||
$result = [];
|
||||
$buffer = '';
|
||||
|
||||
foreach ($parts as $index => $part) {
|
||||
if (0 === $index && '' === $part) {
|
||||
$buffer = '.';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($index === $partsCount - 1 && '' === $part) {
|
||||
$buffer .= '.';
|
||||
$result[] = $buffer;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($parts[$index + 1]) && '' === $parts[$index + 1]) {
|
||||
$buffer .= $part;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($buffer) {
|
||||
$result[] = $buffer.$part;
|
||||
$buffer = '';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[] = $part;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue