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>
105 lines
2.3 KiB
PHP
105 lines
2.3 KiB
PHP
<?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\Console\Helper;
|
|
|
|
/**
|
|
* @implements \IteratorAggregate<TreeNode>
|
|
*
|
|
* @author Simon André <smn.andre@gmail.com>
|
|
*/
|
|
final class TreeNode implements \Countable, \IteratorAggregate
|
|
{
|
|
/**
|
|
* @var array<TreeNode|callable(): \Generator>
|
|
*/
|
|
private array $children = [];
|
|
|
|
public function __construct(
|
|
private readonly string $value = '',
|
|
iterable $children = [],
|
|
) {
|
|
foreach ($children as $child) {
|
|
$this->addChild($child);
|
|
}
|
|
}
|
|
|
|
public static function fromValues(iterable $nodes, ?self $node = null): self
|
|
{
|
|
$node ??= new self();
|
|
foreach ($nodes as $key => $value) {
|
|
if (is_iterable($value)) {
|
|
$child = new self($key);
|
|
self::fromValues($value, $child);
|
|
$node->addChild($child);
|
|
} elseif ($value instanceof self) {
|
|
$node->addChild($value);
|
|
} else {
|
|
$node->addChild(new self($value));
|
|
}
|
|
}
|
|
|
|
return $node;
|
|
}
|
|
|
|
public function getValue(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
public function addChild(self|string|callable $node): self
|
|
{
|
|
if (\is_string($node)) {
|
|
$node = new self($node);
|
|
}
|
|
|
|
$this->children[] = $node;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return \Traversable<int, TreeNode>
|
|
*/
|
|
public function getChildren(): \Traversable
|
|
{
|
|
foreach ($this->children as $child) {
|
|
if (\is_callable($child)) {
|
|
yield from $child();
|
|
} elseif ($child instanceof self) {
|
|
yield $child;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return \Traversable<int, TreeNode>
|
|
*/
|
|
public function getIterator(): \Traversable
|
|
{
|
|
return $this->getChildren();
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
$count = 0;
|
|
foreach ($this->getChildren() as $child) {
|
|
++$count;
|
|
}
|
|
|
|
return $count;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|