Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 11
ProductionMode
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 11
 configure
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 execute
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 9
<?php
namespace Eywa\Console\Mode {
    use Eywa\Exception\Kedavra;
    use Eywa\File\File;
    use Symfony\Component\Console\Command\Command;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    use Symfony\Component\Console\Style\SymfonyStyle;
    class ProductionMode extends Command
    {
        protected static $defaultName = 'app:prod';
        protected function configure(): void
        {
            $this->setDescription('Put the application in production mode');
        }
        /**
         * @param InputInterface $input
         * @param OutputInterface $output
         * @return int
         * @throws Kedavra
         */
        public function execute(InputInterface $input, OutputInterface $output)
        {
            $io = new SymfonyStyle($input, $output);
            $io->title('Enabling the production mode');
            if (
                (new File('config/mode.yaml', EMPTY_AND_WRITE_FILE_MODE))
                ->write("mode: up\nconnexion: prod")
                ->flush()
            ) {
                $io->success('The application is now in production mode');
                return 0;
            }
            $io->error('The change mode command has fail');
            return 1;
        }
    }
}