1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42:
<?php
namespace Inlm\SchemaGenerator\Extractors;
use CzProject\SqlSchema\Schema;
use Inlm\SchemaGenerator\ConfigurationFactory;
use Inlm\SchemaGenerator\IExtractor;
use Nette\Neon\Neon;
use Nette\Utils\FileSystem;
class NeonExtractor implements IExtractor
{
private $file;
public function __construct($file)
{
$this->file = $file;
}
public function generateSchema(array $options = array(), array $customTypes = array(), $databaseType = NULL)
{
$content = FileSystem::read($this->file);
$config = array();
if ($content !== '') {
$config = Neon::decode($content);
}
return ConfigurationFactory::fromArray($config)->getSchema();
}
}