login consent app sql

This commit is contained in:
2022-05-03 08:54:45 +02:00
parent e7253acfd8
commit f9a6535906
1652 changed files with 187600 additions and 45 deletions

44
vendor/symfony/form/Util/FormUtil.php vendored Normal file
View File

@ -0,0 +1,44 @@
<?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\Form\Util;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormUtil
{
/**
* This class should not be instantiated.
*/
private function __construct()
{
}
/**
* Returns whether the given data is empty.
*
* This logic is reused multiple times throughout the processing of
* a form and needs to be consistent. PHP keyword `empty` cannot
* be used as it also considers 0 and "0" to be empty.
*
* @param mixed $data
*
* @return bool
*/
public static function isEmpty($data)
{
// Should not do a check for [] === $data!!!
// This method is used in occurrences where arrays are
// not considered to be empty, ever.
return null === $data || '' === $data;
}
}

View File

@ -0,0 +1,47 @@
<?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\Form\Util;
/**
* Iterator that traverses an array of forms.
*
* Contrary to \ArrayIterator, this iterator recognizes changes in the original
* array during iteration.
*
* You can wrap the iterator into a {@link \RecursiveIteratorIterator} in order to
* enter any child form that inherits its parent's data and iterate the children
* of that form as well.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class InheritDataAwareIterator extends \IteratorIterator implements \RecursiveIterator
{
/**
* {@inheritdoc}
*
* @return static
*/
#[\ReturnTypeWillChange]
public function getChildren()
{
return new static($this->current());
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function hasChildren()
{
return (bool) $this->current()->getConfig()->getInheritData();
}
}

View File

@ -0,0 +1,110 @@
<?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\Form\Util;
use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
*
* @internal
*/
class OptionsResolverWrapper extends OptionsResolver
{
private $undefined = [];
/**
* @return $this
*/
public function setNormalizer(string $option, \Closure $normalizer): self
{
try {
parent::setNormalizer($option, $normalizer);
} catch (UndefinedOptionsException $e) {
$this->undefined[$option] = true;
}
return $this;
}
/**
* @return $this
*/
public function setAllowedValues(string $option, $allowedValues): self
{
try {
parent::setAllowedValues($option, $allowedValues);
} catch (UndefinedOptionsException $e) {
$this->undefined[$option] = true;
}
return $this;
}
/**
* @return $this
*/
public function addAllowedValues(string $option, $allowedValues): self
{
try {
parent::addAllowedValues($option, $allowedValues);
} catch (UndefinedOptionsException $e) {
$this->undefined[$option] = true;
}
return $this;
}
/**
* @param string|array $allowedTypes
*
* @return $this
*/
public function setAllowedTypes(string $option, $allowedTypes): self
{
try {
parent::setAllowedTypes($option, $allowedTypes);
} catch (UndefinedOptionsException $e) {
$this->undefined[$option] = true;
}
return $this;
}
/**
* @param string|array $allowedTypes
*
* @return $this
*/
public function addAllowedTypes(string $option, $allowedTypes): self
{
try {
parent::addAllowedTypes($option, $allowedTypes);
} catch (UndefinedOptionsException $e) {
$this->undefined[$option] = true;
}
return $this;
}
public function resolve(array $options = []): array
{
throw new AccessException('Resolve options is not supported.');
}
public function getUndefinedOptions(): array
{
return array_keys($this->undefined);
}
}

View File

@ -0,0 +1,192 @@
<?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\Form\Util;
/**
* A hash map which keeps track of deletions and additions.
*
* Like in associative arrays, elements can be mapped to integer or string keys.
* Unlike associative arrays, the map keeps track of the order in which keys
* were added and removed. This order is reflected during iteration.
*
* The map supports concurrent modification during iteration. That means that
* you can insert and remove elements from within a foreach loop and the
* iterator will reflect those changes accordingly.
*
* While elements that are added during the loop are recognized by the iterator,
* changed elements are not. Otherwise the loop could be infinite if each loop
* changes the current element:
*
* $map = new OrderedHashMap();
* $map[1] = 1;
* $map[2] = 2;
* $map[3] = 3;
*
* foreach ($map as $index => $value) {
* echo "$index: $value\n"
* if (1 === $index) {
* $map[1] = 4;
* $map[] = 5;
* }
* }
*
* print_r(iterator_to_array($map));
*
* // => 1: 1
* // 2: 2
* // 3: 3
* // 4: 5
* // Array
* // (
* // [1] => 4
* // [2] => 2
* // [3] => 3
* // [4] => 5
* // )
*
* The map also supports multiple parallel iterators. That means that you can
* nest foreach loops without affecting each other's iteration:
*
* foreach ($map as $index => $value) {
* foreach ($map as $index2 => $value2) {
* // ...
* }
* }
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @template TKey of array-key
* @template TValue
*
* @implements \ArrayAccess<TKey, TValue>
* @implements \IteratorAggregate<TKey, TValue>
*/
class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* The elements of the map, indexed by their keys.
*
* @var array<TKey, TValue>
*/
private $elements = [];
/**
* The keys of the map in the order in which they were inserted or changed.
*
* @var list<TKey>
*/
private $orderedKeys = [];
/**
* References to the cursors of all open iterators.
*
* @var array<int, int>
*/
private $managedCursors = [];
/**
* Creates a new map.
*
* @param array<TKey, TValue> $elements The elements to insert initially
*/
public function __construct(array $elements = [])
{
$this->elements = $elements;
$this->orderedKeys = array_keys($elements);
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
{
return isset($this->elements[$key]);
}
/**
* {@inheritdoc}
*
* @return TValue
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
{
if (!isset($this->elements[$key])) {
throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key));
}
return $this->elements[$key];
}
/**
* {@inheritdoc}
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
if (null === $key || !isset($this->elements[$key])) {
if (null === $key) {
$key = [] === $this->orderedKeys
// If the array is empty, use 0 as key
? 0
// Imitate PHP behavior of generating a key that equals
// the highest existing integer key + 1
: 1 + (int) max($this->orderedKeys);
}
$this->orderedKeys[] = (string) $key;
}
$this->elements[$key] = $value;
}
/**
* {@inheritdoc}
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
if (false !== ($position = array_search((string) $key, $this->orderedKeys))) {
array_splice($this->orderedKeys, $position, 1);
unset($this->elements[$key]);
foreach ($this->managedCursors as $i => $cursor) {
if ($cursor >= $position) {
--$this->managedCursors[$i];
}
}
}
}
/**
* @return \Traversable<TKey, TValue>
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new OrderedHashMapIterator($this->elements, $this->orderedKeys, $this->managedCursors);
}
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->elements);
}
}

View File

@ -0,0 +1,172 @@
<?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\Form\Util;
/**
* Iterator for {@link OrderedHashMap} objects.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @internal
*
* @template-covariant TKey of array-key
* @template-covariant TValue
*
* @implements \Iterator<TKey, TValue>
*/
class OrderedHashMapIterator implements \Iterator
{
/**
* @var array<TKey, TValue>
*/
private $elements;
/**
* @var list<TKey>
*/
private $orderedKeys;
/**
* @var int
*/
private $cursor = 0;
/**
* @var int
*/
private $cursorId;
/**
* @var array<int, int>
*/
private $managedCursors;
/**
* @var TKey|null
*/
private $key;
/**
* @var TValue|null
*/
private $current;
/**
* @param array<TKey, TValue> $elements The elements of the map, indexed by their
* keys
* @param list<TKey> $orderedKeys The keys of the map in the order in which
* they should be iterated
* @param array<int, int> $managedCursors An array from which to reference the
* iterator's cursor as long as it is alive.
* This array is managed by the corresponding
* {@link OrderedHashMap} instance to support
* recognizing the deletion of elements.
*/
public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors)
{
$this->elements = &$elements;
$this->orderedKeys = &$orderedKeys;
$this->managedCursors = &$managedCursors;
$this->cursorId = \count($managedCursors);
$this->managedCursors[$this->cursorId] = &$this->cursor;
}
public function __sleep(): array
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
/**
* Removes the iterator's cursors from the managed cursors of the
* corresponding {@link OrderedHashMap} instance.
*/
public function __destruct()
{
// Use array_splice() instead of unset() to prevent holes in the
// array indices, which would break the initialization of $cursorId
array_splice($this->managedCursors, $this->cursorId, 1);
}
/**
* {@inheritdoc}
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->current;
}
/**
* {@inheritdoc}
*/
public function next(): void
{
++$this->cursor;
if (isset($this->orderedKeys[$this->cursor])) {
$this->key = $this->orderedKeys[$this->cursor];
$this->current = $this->elements[$this->key];
} else {
$this->key = null;
$this->current = null;
}
}
/**
* {@inheritdoc}
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
if (null === $this->key) {
return null;
}
$array = [$this->key => null];
return key($array);
}
/**
* {@inheritdoc}
*/
public function valid(): bool
{
return null !== $this->key;
}
/**
* {@inheritdoc}
*/
public function rewind(): void
{
$this->cursor = 0;
if (isset($this->orderedKeys[0])) {
$this->key = $this->orderedKeys[0];
$this->current = $this->elements[$this->key];
} else {
$this->key = null;
$this->current = null;
}
}
}

View File

@ -0,0 +1,101 @@
<?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\Form\Util;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ServerParams
{
private $requestStack;
public function __construct(RequestStack $requestStack = null)
{
$this->requestStack = $requestStack;
}
/**
* Returns true if the POST max size has been exceeded in the request.
*
* @return bool
*/
public function hasPostMaxSizeBeenExceeded()
{
$contentLength = $this->getContentLength();
$maxContentLength = $this->getPostMaxSize();
return $maxContentLength && $contentLength > $maxContentLength;
}
/**
* Returns maximum post size in bytes.
*
* @return int|float|null
*/
public function getPostMaxSize()
{
$iniMax = strtolower($this->getNormalizedIniPostMaxSize());
if ('' === $iniMax) {
return null;
}
$max = ltrim($iniMax, '+');
if (str_starts_with($max, '0x')) {
$max = \intval($max, 16);
} elseif (str_starts_with($max, '0')) {
$max = \intval($max, 8);
} else {
$max = (int) $max;
}
switch (substr($iniMax, -1)) {
case 't': $max *= 1024;
// no break
case 'g': $max *= 1024;
// no break
case 'm': $max *= 1024;
// no break
case 'k': $max *= 1024;
}
return $max;
}
/**
* Returns the normalized "post_max_size" ini setting.
*
* @return string
*/
public function getNormalizedIniPostMaxSize()
{
return strtoupper(trim(ini_get('post_max_size')));
}
/**
* Returns the content length of the request.
*
* @return mixed
*/
public function getContentLength()
{
if (null !== $this->requestStack && null !== $request = $this->requestStack->getCurrentRequest()) {
return $request->server->get('CONTENT_LENGTH');
}
return isset($_SERVER['CONTENT_LENGTH'])
? (int) $_SERVER['CONTENT_LENGTH']
: null;
}
}

57
vendor/symfony/form/Util/StringUtil.php vendored Normal file
View File

@ -0,0 +1,57 @@
<?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\Form\Util;
/**
* @author Issei Murasawa <issei.m7@gmail.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class StringUtil
{
/**
* This class should not be instantiated.
*/
private function __construct()
{
}
/**
* Returns the trimmed data.
*
* @return string
*/
public static function trim(string $string)
{
if (null !== $result = @preg_replace('/^[\pZ\p{Cc}\p{Cf}]+|[\pZ\p{Cc}\p{Cf}]+$/u', '', $string)) {
return $result;
}
return trim($string);
}
/**
* Converts a fully-qualified class name to a block prefix.
*
* @param string $fqcn The fully-qualified class name
*
* @return string|null
*/
public static function fqcnToBlockPrefix(string $fqcn)
{
// Non-greedy ("+?") to match "type" suffix, if present
if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1]));
}
return null;
}
}