10 use Symfony\Component\Console\Command\Command;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Input\InputArgument;
55 parent::__construct();
64 $this->setName(self::COMMAND_NAME)
65 ->setDescription(
'Enable the profiler.')
66 ->addArgument(
'type', InputArgument::OPTIONAL,
'Profiler type');
77 $type = $input->getArgument(
'type');
82 if (!in_array(
$type, self::BUILT_IN_TYPES,
true)) {
83 $builtInTypes = implode(
', ', self::BUILT_IN_TYPES);
86 . sprintf(
'Type %s is not one of the built-in output types (%s).',
$type, $builtInTypes) .
91 $this->filesystem->write(
BP .
'/' . self::PROFILER_FLAG_FILE,
$type);
92 if ($this->filesystem->fileExists(
BP .
'/' . self::PROFILER_FLAG_FILE)) {
93 $output->write(
'<info>'. sprintf(self::SUCCESS_MESSAGE,
$type) .
'</info>');
94 if (
$type ==
'csvfile') {
97 'Output will be saved in %s',
98 \
Magento\Framework\Profiler\Driver\Standard\Output\Csvfile::DEFAULT_FILEPATH
107 $output->writeln(
'<error>Something went wrong while enabling the profiler.</error>');
execute(InputInterface $input, OutputInterface $output)
__construct(File $filesystem)