diff --git a/src/Common/ProcessAwareTrait.php b/src/Common/ProcessAwareTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..6d15d0ef2a02821fbd51dae4825124b00b6304ac --- /dev/null +++ b/src/Common/ProcessAwareTrait.php @@ -0,0 +1,68 @@ +process = $process; + return $this; + } + + /** + * @return Process + */ + public function getProcess() + { + if (is_null($this->process)) { + $this->process = new Process($this->command); + } + return $this->process; + + } + + /** + * @param $command + * + * @return $this + */ + public function setCommand($command) { + + $this->command = $command; + + return $this; + } + + /** + * @return string + */ + public function getCommand() { + + return $this->command; + } + + public function execute() { + $this->process->run(); + } + +} diff --git a/src/Service/Http/Php/PhpServer.php b/src/Service/Http/Php/PhpServer.php new file mode 100644 index 0000000000000000000000000000000000000000..8200d0d748adedabfd142937e264f46030b7c8e7 --- /dev/null +++ b/src/Service/Http/Php/PhpServer.php @@ -0,0 +1,79 @@ +port = $port; + + if (strtolower(PHP_OS) === 'linux') { + $this->command = 'exec php -S %s:%d '; + } + } + + /** + * @param string $host + * + * @return $this + */ + public function host($host) + { + $this->host = $host; + return $this; + } + + /** + * @param string $path + * + * @return $this + */ + public function dir($path) + { + $this->command .= "-t $path"; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCommand() + { + return sprintf($this->command, $this->host, $this->port); + } + + public function run() { + $this->executeCommand($this->getCommand()); + } + + public function getProcess() { + return $this->process; + } + + public function task() { + + } +} \ No newline at end of file diff --git a/src/ServiceInterface.php b/src/ServiceInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..eba930f1d51668267817bbaa105303b30245608f --- /dev/null +++ b/src/ServiceInterface.php @@ -0,0 +1,25 @@ +