/**
  * Runs through the files int the API src dir, and pulls the public methods out
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setInputOutput($input, $output);
     $this->output->writeln("<info>Formatting generated code...</info>");
     $this->generator->setAndMakeApiDirectory($this->input->getOption('directory'), false, $this->output);
     $script = $this->generator->vendorDirectory($this->relative_fmt_path);
     $commands = $this->getFormatterOptions();
     $files = $this->determineFiles();
     $response = $this->request->setCommand(implode(" ", [$script, $commands, $files]))->run(500, 500);
     $this->outputResponse($response);
 }
 /**
  * The generator hard codes the full wsdl into the code, so this removes it
  */
 private function removeHostName()
 {
     $this->output->writeln("<info>Removing hardcoded hostname...</info>");
     $command = 'sed -i "" "s|' . preg_quote($this->generator->hostPath()) . '||g" ' . $this->generator->generatedDirectory('*.php', false);
     $response = $this->request->setCommand($command)->run();
     $this->outputResponse($response);
 }
 /**
  * @test
  */
 public function it_runs_the_command_and_tracks_error()
 {
     $this->setUpRequest();
     $this->setUpRun();
     $this->process_mock->shouldReceive('getCommandLine')->withNoArgs()->andReturn('Command')->once();
     $this->process_mock->shouldReceive('getExitCode')->withNoArgs()->andReturn(0)->once();
     $this->process_mock->shouldReceive('isSuccessful')->withNoArgs()->andReturn(false)->twice();
     $this->process_mock->shouldReceive('getOutput')->never();
     $this->process_mock->shouldReceive('getErrorOutput')->withNoArgs()->andReturn('Error')->once();
     $this->assertInstanceOf('Spinen\\ConnectWise\\Generator\\CommandLine\\Response', $this->request->run());
 }