getConfigFilePath(); if (!file_exists($configFile)) { throw new Exception('Unable to find configuration file "' . $configFile . '"'); } $lines = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($lines === false) { throw new Exception('Unable to read configuration file "' . $configFile . '"'); } foreach ($lines as $line) { if (preg_match('/^\s*(?:(?#).*|(?[a-zA-Z\\d_-]+)=(?.+?))$/i', $line, $match) !== 1) { continue; // Ligne invalide } if (isset($match['comment']) && trim($match['comment']) !== '') { continue; // Commentaire } if (preg_match('/^"(?.+)(?properties->set($match['key'], $match['value']); } } }