feat: Version 3.5.2 - Configuration Stripe et gestion des immeubles

- Configuration complète Stripe pour les 3 environnements (DEV/REC/PROD)
  * DEV: Clés TEST Pierre (mode test)
  * REC: Clés TEST Client (mode test)
  * PROD: Clés LIVE Client (mode live)
- Ajout de la gestion des bases de données immeubles/bâtiments
  * Configuration buildings_database pour DEV/REC/PROD
  * Service BuildingService pour enrichissement des adresses
- Optimisations pages et améliorations ergonomie
- Mises à jour des dépendances Composer
- Nettoyage des fichiers obsolètes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
pierre
2025-11-09 18:26:27 +01:00
parent 21657a3820
commit 2f5946a184
812 changed files with 142105 additions and 25992 deletions

View File

@@ -69,14 +69,6 @@ class Csv extends BaseReader
*/
private ?string $escapeCharacter = null;
/**
* The character that will be supplied to fgetcsv
* when escapeCharacter is null.
* It is anticipated that it will conditionally be set
* to null-string for Php9 and above.
*/
private static string $defaultEscapeCharacter = PHP_VERSION_ID < 90000 ? '\\' : '';
/**
* Callback for setting defaults in construction.
*
@@ -84,10 +76,13 @@ class Csv extends BaseReader
*/
private static $constructorCallback;
/** Changed from true to false in release 4.0.0 */
public const DEFAULT_TEST_AUTODETECT = false;
/**
* Attempt autodetect line endings (deprecated after PHP8.1)?
*/
private bool $testAutodetect = true;
private bool $testAutodetect = self::DEFAULT_TEST_AUTODETECT;
protected bool $castFormattedNumberToNumeric = false;
@@ -193,11 +188,12 @@ class Csv extends BaseReader
*/
protected function inferSeparator(): void
{
if ($this->delimiter !== null) {
$temp = $this->delimiter;
if ($temp !== null) {
return;
}
$inferenceEngine = new Delimiter($this->fileHandle, $this->escapeCharacter ?? self::$defaultEscapeCharacter, $this->enclosure);
$inferenceEngine = new Delimiter($this->fileHandle, $this->getEscapeCharacter(), $this->enclosure);
// If number of lines is 0, nothing to infer : fall back to the default
if ($inferenceEngine->linesCounted() === 0) {
@@ -219,6 +215,8 @@ class Csv extends BaseReader
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
*
* @return array<int, array{worksheetName: string, lastColumnLetter: string, lastColumnIndex: int, totalRows: int, totalColumns: int, sheetState: string}>
*/
public function listWorksheetInfo(string $filename): array
{
@@ -231,12 +229,15 @@ class Csv extends BaseReader
$this->checkSeparator();
$this->inferSeparator();
$worksheetInfo = [];
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
$worksheetInfo[0]['lastColumnLetter'] = 'A';
$worksheetInfo[0]['lastColumnIndex'] = 0;
$worksheetInfo[0]['totalRows'] = 0;
$worksheetInfo[0]['totalColumns'] = 0;
$worksheetInfo = [
[
'worksheetName' => 'Worksheet',
'lastColumnLetter' => 'A',
'lastColumnIndex' => 0,
'totalRows' => 0,
'totalColumns' => 0,
],
];
$delimiter = $this->delimiter ?? '';
// Loop through each line of the file in turn
@@ -249,6 +250,7 @@ class Csv extends BaseReader
$worksheetInfo[0]['lastColumnLetter'] = Coordinate::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex'] + 1);
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
$worksheetInfo[0]['sheetState'] = Worksheet::SHEETSTATE_VISIBLE;
// Close file
fclose($fileHandle);
@@ -261,8 +263,8 @@ class Csv extends BaseReader
*/
protected function loadSpreadsheetFromFile(string $filename): Spreadsheet
{
// Create new Spreadsheet
$spreadsheet = new Spreadsheet();
$spreadsheet = $this->newSpreadsheet();
$spreadsheet->setValueBinder($this->valueBinder);
// Load into this instance
return $this->loadIntoExisting($filename, $spreadsheet);
@@ -273,8 +275,8 @@ class Csv extends BaseReader
*/
public function loadSpreadsheetFromString(string $contents): Spreadsheet
{
// Create new Spreadsheet
$spreadsheet = new Spreadsheet();
$spreadsheet = $this->newSpreadsheet();
$spreadsheet->setValueBinder($this->valueBinder);
// Load into this instance
return $this->loadStringOrFile('data://text/plain,' . urlencode($contents), $spreadsheet, true);
@@ -317,10 +319,10 @@ class Csv extends BaseReader
return $this;
}
private function setAutoDetect(?string $value): ?string
private function setAutoDetect(?string $value, int $version = PHP_VERSION_ID): ?string
{
$retVal = null;
if ($value !== null && $this->testAutodetect && PHP_VERSION_ID < 90000) {
if ($value !== null && $this->testAutodetect && $version < 90000) {
$retVal2 = @ini_set('auto_detect_line_endings', $value);
if (is_string($retVal2)) {
$retVal = $retVal2;
@@ -383,6 +385,7 @@ class Csv extends BaseReader
private function loadStringOrFile2(string $filename, Spreadsheet $spreadsheet, bool $dataUri): void
{
// Open file
if ($dataUri) {
$this->openDataUri($filename);
@@ -412,7 +415,7 @@ class Csv extends BaseReader
// Loop through each line of the file in turn
$delimiter = $this->delimiter ?? '';
$rowData = self::getCsv($fileHandle, 0, $delimiter, $this->enclosure, $this->escapeCharacter);
$valueBinder = Cell::getValueBinder();
$valueBinder = $this->valueBinder ?? Cell::getValueBinder();
$preserveBooleanString = method_exists($valueBinder, 'getBooleanConversion') && $valueBinder->getBooleanConversion();
$this->getTrue = Calculation::getTRUE();
$this->getFalse = Calculation::getFALSE();
@@ -446,7 +449,7 @@ class Csv extends BaseReader
// Set cell value
$sheet->getCell($columnLetter . $outRow)->setValue($rowDatum);
}
++$columnLetter;
StringHelper::stringIncrement($columnLetter);
}
$rowData = self::getCsv($fileHandle, 0, $delimiter, $this->enclosure, $this->escapeCharacter);
++$currentRow;
@@ -559,9 +562,9 @@ class Csv extends BaseReader
* Not yet ready to mark deprecated in order to give users
* a migration path.
*/
public function setEscapeCharacter(string $escapeCharacter): self
public function setEscapeCharacter(string $escapeCharacter, int $version = PHP_VERSION_ID): self
{
if (PHP_VERSION_ID >= 90000 && $escapeCharacter !== '') {
if ($version >= 90000 && $escapeCharacter !== '') {
throw new ReaderException('Escape character must be null string for Php9+');
}
@@ -570,9 +573,9 @@ class Csv extends BaseReader
return $this;
}
public function getEscapeCharacter(): string
public function getEscapeCharacter(int $version = PHP_VERSION_ID): string
{
return $this->escapeCharacter ?? self::$defaultEscapeCharacter;
return $this->escapeCharacter ?? self::getDefaultEscapeCharacter($version);
}
/**
@@ -602,6 +605,7 @@ class Csv extends BaseReader
'text/csv',
'text/plain',
'inode/x-empty',
'application/x-empty', // has now replaced previous
'text/html',
];
@@ -621,7 +625,7 @@ class Csv extends BaseReader
private static function guessEncodingNoBom(string $filename): string
{
$encoding = '';
$contents = file_get_contents($filename);
$contents = (string) file_get_contents($filename);
self::guessEncodingTestNoBom($encoding, $contents, self::UTF32BE_LF, 'UTF-32BE');
self::guessEncodingTestNoBom($encoding, $contents, self::UTF32LE_LF, 'UTF-32LE');
self::guessEncodingTestNoBom($encoding, $contents, self::UTF16BE_LF, 'UTF-16BE');
@@ -698,10 +702,11 @@ class Csv extends BaseReader
?int $length = null,
string $separator = ',',
string $enclosure = '"',
?string $escape = null
?string $escape = null,
int $version = PHP_VERSION_ID
): array|false {
$escape = $escape ?? self::$defaultEscapeCharacter;
if (PHP_VERSION_ID >= 80400 && $escape !== '') {
$escape = $escape ?? self::getDefaultEscapeCharacter();
if ($version >= 80400 && $escape !== '') {
return @fgetcsv($stream, $length, $separator, $enclosure, $escape);
}
@@ -713,10 +718,11 @@ class Csv extends BaseReader
string $inputEncoding = 'UTF-8',
?string $delimiter = null,
string $enclosure = '"',
string $escapeCharacter = '\\'
string $escapeCharacter = '\\',
int $version = PHP_VERSION_ID
): bool {
if (PHP_VERSION_ID < 70400 || PHP_VERSION_ID >= 90000) {
throw new ReaderException('Function valid only for Php7.4 or Php8'); // @codeCoverageIgnore
if ($version < 70400 || $version >= 90000) {
throw new ReaderException('Function valid only for Php7.4 or Php8');
}
$reader1 = new self();
$reader1->setInputEncoding($inputEncoding)
@@ -742,4 +748,15 @@ class Csv extends BaseReader
return $array1 !== $array2;
}
/**
* The character that will be supplied to fgetcsv
* when escapeCharacter is null.
* It is anticipated that it will conditionally be set
* to null-string for Php9 and above.
*/
private static function getDefaultEscapeCharacter(int $version = PHP_VERSION_ID): string
{
return $version < 90000 ? '\\' : '';
}
}