getArgument('api')) { 'public' => $this->schemaFactory->createPublicSchema(), 'pos' => $this->schemaFactory->createPosSchema(), 'admin' => $this->schemaFactory->createAdminSchema(), default => throw new \InvalidArgumentException('Invalid argument'), }; if ($file = $input->getOption('file')) { $output->writeln('=== Dumping schema to file '.realpath($file).'...'); file_put_contents($file, SchemaPrinter::doPrint($schema)); } else { $output->write(SchemaPrinter::doPrint($schema)); } return Command::SUCCESS; } protected function configure(): void { $this->setName('kupshop:graphql-dump-schema') ->setDescription('Prints the GraphQL schema in Schema Definition Language (SDL)') ->addArgument('api', InputArgument::OPTIONAL, 'Which api schema to export [public, pos, admin]', 'public') ->addOption('file', 'f', InputArgument::OPTIONAL, 'File to export to'); } public function isEnabled(): bool { return isLocalDevelopment(); } }