/** * Execute the command. * * {@inheritdoc} * * @param InputInterface $input the input interface * @param OutputInterface $output the output interface */ protected function execute(InputInterface $input, OutputInterface $output) { $path = $this->getPath($input); $factory = new Factory(); $files = false; foreach ($factory->getKnownWebServers() as $webservername) { $webserver = $factory->createWebServer($webservername); $file = $this->searchBinary($path, $webserver, $output); $files = $files || strlen($file) > 0; } if (!$files) { $output->writeln('<error>No Web Server Found.</error>'); return 1; } }
protected function getWebServer(InputInterface $input, OutputInterface $output) { $webservername = $input->getArgument('webserver'); $version = 0; if (preg_match(',([^:]+)(:([\\.\\d]+))$,', $webservername, $matches)) { $version = $matches[3]; $webservername = $matches[1]; } $factory = new Factory(); $webserver = $factory->createWebServer($webservername, $version); if ($webserver instanceof NullWebServer) { $output->writeln('<error>Web Server "' . $webservername . '" unknown.</error>'); $output->writeln('<comment>Known Web Servers are ' . implode(' or ', $factory->getKnownWebServers()) . '.</comment>'); } return $webserver; }
/** * Sets the PHP Webapp to configure. * * @param string $projectname a PHP Webapp name * @param string $version a semver-like version */ public function setProject($projectname, $version) { $factory = new Factory(); $this->project = $factory->createWebProject($projectname, $this->versionParser->normalize($version)); return $this; }