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
176
vendor/league/csv/src/Query/Row.php
vendored
Normal file
176
vendor/league/csv/src/Query/Row.php
vendored
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* League.Csv (https://csv.thephpleague.com)
|
||||
*
|
||||
* (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace League\Csv\Query;
|
||||
|
||||
use ArrayAccess;
|
||||
use ReflectionException;
|
||||
use ReflectionObject;
|
||||
use TypeError;
|
||||
|
||||
use function array_is_list;
|
||||
use function array_key_exists;
|
||||
use function array_map;
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function is_int;
|
||||
use function is_object;
|
||||
use function lcfirst;
|
||||
use function str_replace;
|
||||
|
||||
final class Row
|
||||
{
|
||||
public static function from(mixed $value): Row
|
||||
{
|
||||
return new self(match (true) {
|
||||
is_object($value),
|
||||
is_array($value) => $value,
|
||||
default => throw new TypeError('The value must be an array or an object; received '.gettype($value).'.'),
|
||||
});
|
||||
}
|
||||
|
||||
private function __construct(private readonly array|object $row)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to retrieve a single value from a record.
|
||||
*
|
||||
* @throws ReflectionException
|
||||
* @throws QueryException If the value can not be retrieved
|
||||
* @see Row::select()
|
||||
*
|
||||
*/
|
||||
public function value(string|int $key): mixed
|
||||
{
|
||||
return $this->select($key)[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to retrieve multiple values from a record.
|
||||
*
|
||||
* If the value is an array and the key is an integer the content will be retrieved
|
||||
* from the array_values array form. Negative offset are supported.
|
||||
* If the value is an object, the key MUST be a string.
|
||||
*
|
||||
* @throws ReflectionException
|
||||
* @throws QueryException If the value can not be retrieved
|
||||
*
|
||||
* @return non-empty-array<array-key, mixed>
|
||||
*/
|
||||
public function select(string|int ...$key): array
|
||||
{
|
||||
return match (true) {
|
||||
is_object($this->row) => self::getObjectPropertyValue($this->row, ...$key),
|
||||
default => self::getArrayEntry($this->row, ...$key),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws QueryException
|
||||
*
|
||||
* @return non-empty-array<array-key, mixed>
|
||||
*/
|
||||
private function getArrayEntry(array $row, string|int ...$keys): array
|
||||
{
|
||||
$res = [];
|
||||
$arrValues = array_values($row);
|
||||
foreach ($keys as $key) {
|
||||
if (array_key_exists($key, $res)) {
|
||||
continue;
|
||||
}
|
||||
$offset = $key;
|
||||
if (is_int($offset)) {
|
||||
if (!array_is_list($row)) {
|
||||
$row = $arrValues;
|
||||
}
|
||||
|
||||
if ($offset < 0) {
|
||||
$offset += count($row);
|
||||
}
|
||||
}
|
||||
|
||||
$res[$key] = array_key_exists($offset, $row) ? $row[$offset] : throw QueryException::dueToUnknownColumn($key, $row);
|
||||
}
|
||||
|
||||
return [] !== $res ? $res : throw QueryException::dueToMissingColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
* @throws QueryException
|
||||
*
|
||||
* @return non-empty-array<array-key, mixed>
|
||||
*/
|
||||
private static function getObjectPropertyValue(object $row, string|int ...$keys): array
|
||||
{
|
||||
$res = [];
|
||||
$object = new ReflectionObject($row);
|
||||
foreach ($keys as $key) {
|
||||
if (array_key_exists($key, $res)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
!is_int($key) || throw QueryException::dueToUnknownColumn($key, $row);
|
||||
|
||||
if ($object->hasProperty($key) && $object->getProperty($key)->isPublic()) {
|
||||
$res[$key] = $object->getProperty($key)->getValue($row);
|
||||
continue;
|
||||
}
|
||||
|
||||
$methodNameList = [$key];
|
||||
if (($camelCasedKey = self::camelCase($key)) !== $key) {
|
||||
$methodNameList[] = $camelCasedKey;
|
||||
}
|
||||
$methodNameList[] = self::camelCase($key, 'get');
|
||||
foreach ($methodNameList as $methodName) {
|
||||
if ($object->hasMethod($methodName)
|
||||
&& $object->getMethod($methodName)->isPublic()
|
||||
&& 1 > $object->getMethod($methodName)->getNumberOfRequiredParameters()
|
||||
) {
|
||||
$res[$key] = $object->getMethod($methodName)->invoke($row);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (method_exists($row, '__call')) {
|
||||
$res[$key] = $object->getMethod('__call')->invoke($row, $methodNameList[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($row instanceof ArrayAccess && $row->offsetExists($key)) {
|
||||
$res[$key] = $row->offsetGet($key);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw QueryException::dueToUnknownColumn($key, $row);
|
||||
}
|
||||
|
||||
return [] !== $res ? $res : throw QueryException::dueToMissingColumn();
|
||||
}
|
||||
|
||||
private static function camelCase(string $value, string $prefix = ''): string
|
||||
{
|
||||
if ('' !== $prefix) {
|
||||
$prefix .= '_';
|
||||
}
|
||||
|
||||
return lcfirst(implode('', array_map(
|
||||
ucfirst(...),
|
||||
explode(' ', str_replace(['-', '_'], ' ', $prefix.$value))
|
||||
)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue