From 7978cdea8dc174516765b0c6f263408b1e6d796a Mon Sep 17 00:00:00 2001 From: Eher Date: Fri, 5 Dec 2014 01:08:35 +0100 Subject: [PATCH] [AUTO] php-cs-fix --- features/bootstrap/FeatureContext.php | 22 +++++------- src/Eher/PHPWatch/PHPWatchCommand.php | 50 ++++++++++++++------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 2b92f86..986c55d 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -1,11 +1,7 @@ output = trim(implode("\n", $output)); + exec($command, $output); + $this->output = trim(implode("\n", $output)); } /** @Then /^I should get:$/ */ @@ -44,7 +40,7 @@ public function iShouldGet(PyStringNode $string) { if ((string) $string !== $this->output) { throw new Exception( - "Actual output is:\n" . $this->output + "Actual output is:\n".$this->output ); } } diff --git a/src/Eher/PHPWatch/PHPWatchCommand.php b/src/Eher/PHPWatch/PHPWatchCommand.php index 5a1921f..96a50a0 100644 --- a/src/Eher/PHPWatch/PHPWatchCommand.php +++ b/src/Eher/PHPWatch/PHPWatchCommand.php @@ -40,7 +40,7 @@ private function proccessOptions($options) $this->writeln(""); exit(1); } else { - $this->extension = "*." . $options['ext']; + $this->extension = "*.".$options['ext']; } } @@ -55,38 +55,38 @@ private function proccessOptions($options) private function showHelp() { - $this->writeln("Usage: phpwatch [options] \"command\" path"); - $this->writeln(""); - $this->writeln(" --ext Filter files by extension"); - $this->writeln(" --once Executes the command once"); - $this->writeln(" --verbose Verbose mode"); - $this->writeln(" --help Show this message"); - $this->writeln(" --version Show the version"); - $this->writeln(""); - exit; + $this->writeln("Usage: phpwatch [options] \"command\" path"); + $this->writeln(""); + $this->writeln(" --ext Filter files by extension"); + $this->writeln(" --once Executes the command once"); + $this->writeln(" --verbose Verbose mode"); + $this->writeln(" --help Show this message"); + $this->writeln(" --version Show the version"); + $this->writeln(""); + exit; } private function showVersion() { - $this->writeln("New Version!"); - exit; + $this->writeln("New Version!"); + exit; } private function watchFiles($command, $path) { - $this->writeln("phpwatch: running..."); - if ($this->verbose) { - $this->writeln("Watching => $path"); - } - while(true) { - if ($this->hasChangesIn($path)) { - $this->runCommand($command); - if ($this->once) { - exit; - } + $this->writeln("phpwatch: running..."); + if ($this->verbose) { + $this->writeln("Watching => $path"); + } + while (true) { + if ($this->hasChangesIn($path)) { + $this->runCommand($command); + if ($this->once) { + exit; } - sleep(1); } + sleep(1); + } } private function hasChangesIn($path) @@ -104,8 +104,10 @@ private function hasChangesIn($path) if ($this->verbose) { $this->writeln($file->getRelativePathname()); } + return true; } + return false; } @@ -119,6 +121,6 @@ private function runCommand($command) private function showDefaultMessage() { - $this->writeln("Use 'phpwatch --help' for more info"); + $this->writeln("Use 'phpwatch --help' for more info"); } }