for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Smart\EtlBundle\Transformer;
/**
* Nicolas Bastien <[email protected]>
*/
class IconvTransformer implements TransformerInterface
{
* @var string
protected $inCharset;
protected $outCharset;
public function __construct($inCharset, $outCharset)
$this->inCharset = $inCharset;
$this->outCharset = $outCharset;
}
* @inheritdoc
public function transform(array $data)
foreach ($data as $key => $value) {
$convertedKey = iconv($this->inCharset, $this->outCharset, $key);
$data[$convertedKey] = iconv($this->inCharset, $this->outCharset, $value);
if (strcmp($key, $convertedKey) !== 0) {
unset($data[$key]);
return $data;