/** * Loops through the allowed config file types and checks if any schematic config file exists for the project and it * returns the file type it's found if there is one * * @return bool */ private function getConfigFileType() { foreach (Configurations::allowedConfigurationFileTypes() as $allowedFileType) { $fileToCheckFor = self::CONFIG_FILE_NAME . '.' . $allowedFileType; if (file_exists($fileToCheckFor)) { $this->output->writeln('<info>Schematic config files are in ' . $allowedFileType . ' format</info>'); $this->configFileExists = true; $this->configFilePath = $fileToCheckFor; return $allowedFileType; } } return false; }
protected function execute(InputInterface $input, OutputInterface $output) { $helper = $this->getHelper('question'); $dialog = $this->getHelper('dialog'); $output->writeln('<info>Initializing Schematic for this project...</info>'); $fileTypes = Configurations::allowedConfigurationFileTypes(); $fileTypeResult = $dialog->select($output, 'Please select which file type to use (yaml or json)', $fileTypes, 0); $fileType = $fileTypes[$fileTypeResult]; $output->writeln('<comment>Using: ' . $fileType . '</comment>'); $fileAdapterClass = '\\Library\\Migrations\\FileApi\\Adapters\\' . ucfirst($fileType) . 'Adapter'; $schematicInstaller = new SchematicInstaller($output, new $fileAdapterClass($output)); $schematicInstaller->setFileFormatType($fileType)->run(); }