siip-stripe-payment_intents/vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php
DANYDHSV c43bb924d7 feat: lanzamiento inicial del plugin Generador de Payment Intents
- Implementado servicio backend [PaymentIntentService](cci:2://file:///home/unms/data/ucrm/ucrm/data/plugins/siip-stripe-payment_intents/src/PaymentIntentService.php:8:0-152:1) para manejar interacciones con API de UCRM y Stripe.
- Creado frontend moderno y responsivo en HTML/JS dentro de [public.php](cci:7://file:///home/unms/data/ucrm/ucrm/data/plugins/siip-stripe-payment_intents/public.php:0:0-0:0).
- Agregada búsqueda con autocompletado para clientes.
- Agregada validación para Stripe Customer ID y monto mínimo.
- Integrada la creación de Payment Intents de Stripe para fondos tipo `customer_balance`.
- Agregada documentación (README.md, CHANGELOG.md) y limpieza de archivos legado.
2025-12-16 13:56:31 -06:00

97 lines
2.2 KiB
PHP

<?php
namespace Stripe\Util;
/**
* CaseInsensitiveArray is an array-like class that ignores case for keys.
*
* It is used to store HTTP headers. Per RFC 2616, section 4.2:
* Each header field consists of a name followed by a colon (":") and the field value. Field names
* are case-insensitive.
*
* In the context of stripe-php, this is useful because the API will return headers with different
* case depending on whether HTTP/2 is used or not (with HTTP/2, headers are always in lowercase).
*/
class CaseInsensitiveArray implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $container = [];
public function __construct($initial_array = [])
{
$this->container = \array_change_key_case($initial_array, \CASE_LOWER);
}
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->container);
}
/**
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->container);
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$offset = self::maybeLowercase($offset);
if (null === $offset) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$offset = self::maybeLowercase($offset);
return isset($this->container[$offset]);
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$offset = self::maybeLowercase($offset);
unset($this->container[$offset]);
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$offset = self::maybeLowercase($offset);
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
private static function maybeLowercase($v)
{
if (\is_string($v)) {
return \strtolower($v);
}
return $v;
}
}