diff --git a/src/MLD/Console/Command/ExportCommand.php b/src/MLD/Console/Command/ExportCommand.php index 39724c65..ef55aa73 100755 --- a/src/MLD/Console/Command/ExportCommand.php +++ b/src/MLD/Console/Command/ExportCommand.php @@ -34,6 +34,7 @@ class ExportCommand extends Command 'csv' => ['class' => '\MLD\Converter\CsvConverter', 'output_file' => 'countries.csv'], 'xml' => ['class' => '\MLD\Converter\XmlConverter', 'output_file' => 'countries.xml'], 'yml' => ['class' => '\MLD\Converter\YamlConverter', 'output_file' => 'countries.yml'], + 'php' => ['class' => '\MLD\Converter\PHPConverter', 'output_file' => 'countries.php'] ]; /** diff --git a/src/MLD/Converter/PHPConverter.php b/src/MLD/Converter/PHPConverter.php new file mode 100644 index 00000000..b5053d32 --- /dev/null +++ b/src/MLD/Converter/PHPConverter.php @@ -0,0 +1,40 @@ +countries, [$this, 'processCountry']); + return $this->prefix . "\n" . implode(",\n",$this->bodyChunks) . "\n" . $this->suffix; + } + + private function processCountry(&$array) + { + $this->bodyChunks[] = + "'".$array['cca2'] ."' => " . var_export($array, true); + } +} \ No newline at end of file