'.ini' ]; parent::__construct($config); } /** * {@inheritdoc} * @see FileFormatterInterface::encode() */ public function encode($data): string { $string = ''; foreach ($data as $key => $value) { $string .= $key . '="' . preg_replace( ['/"/', '/\\\/', "/\t/", "/\n/", "/\r/"], ['\"', '\\\\', '\t', '\n', '\r'], $value ) . "\"\n"; } return $string; } /** * {@inheritdoc} * @see FileFormatterInterface::decode() */ public function decode($data): array { $decoded = @parse_ini_string($data); if ($decoded === false) { throw new \RuntimeException('Decoding INI failed'); } return $decoded; } }