AOEpeople/StackFormation

View on GitHub
src/AwsInspector/Command/Profile/DisableCommand.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace AwsInspector\Command\Profile;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DisableCommand extends Command
{

    protected function configure()
    {
        $this
            ->setName('profile:disable')
            ->setDescription('Disable current profile');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!is_file('.env')) {
            $output->writeln('No .env file found');
            return;
        }
        if (!unlink('.env')) {
            throw new \Exception('Error deleting .env file');
        }
        $output->writeln('Deleted file .env');
    }

}