src/Console/Command/DataExport/Create.php
private function createSource(): void
    {
        $aFields               = $this->getArguments();
        $aFields['CLASS_NAME'] = str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z ]/', '', $aFields['NAME'])));
        $aFields['FILENAME']   = strtolower(url_title($aFields['NAME']));

        try {

            $this->oOutput->write('Creating DataExport Source <comment>' . $aFields['CLASS_NAME'] . '</comment>... ');

            //  Check for existing DataExport source
            $sPath = static::EXPORT_PATH . $aFields['CLASS_NAME'] . '.php';
            if (file_exists($sPath)) {
                throw new ControllerExistsException(
                    'DataExport Source "' . $aFields['CLASS_NAME'] . '" exists already at path "' . $sPath . '"'
                );
            }

            $this->createFile($sPath, $this->getResource('template/data_export_source.php', $aFields));
            $aCreated[] = $sPath;
            $this->oOutput->writeln('<info>done!</info>');

        } catch (\Exception $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            throw new NailsException($e->getMessage());
        }
    }
private function createSource(): void
    {
        $aFields               = $this->getArguments();
        $aFields['CLASS_NAME'] = str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z ]/', '', $aFields['NAME'])));
        $aFields['FILENAME']   = strtolower(url_title($aFields['NAME']));

        try {

            $this->oOutput->write('Creating DataExport Source <comment>' . $aFields['CLASS_NAME'] . '</comment>... ');

            //  Check for existing DataExport source
            $sPath = static::EXPORT_PATH . $aFields['CLASS_NAME'] . '.php';
            if (file_exists($sPath)) {
                throw new ControllerExistsException(
                    'DataExport Source "' . $aFields['CLASS_NAME'] . '" exists already at path "' . $sPath . '"'
                );
            }

            $this->createFile($sPath, $this->getResource('template/data_export_source.php', $aFields));
            $aCreated[] = $sPath;
            $this->oOutput->writeln('<info>done!</info>');

        } catch (\Exception $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            throw new NailsException($e->getMessage());
        }
    }
Create the Model

@return void
@throws \Exception