Commit: e852ef0bc47117e3adcb8b5e9165782411b8b72f
Author: David Persson | Date: 2009-12-10 11:44:53 +0100
diff --git a/extensions/command/syntax/Base.php b/extensions/command/syntax/Base.php
index c3ede58..a7cdfe0 100644
--- a/extensions/command/syntax/Base.php
+++ b/extensions/command/syntax/Base.php
@@ -30,6 +30,24 @@ abstract class Base extends \lithium\console\Command {
* an array of violation messages.
*/
abstract public function process($file);
+
+ protected function _which($command) {
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
+ return trim(shell_exec('which php'));
+ }
+ $extensions = array('.exe', '.bat', '.cmd', '.com', '');
+ $paths = explode(PATH_SEPARATOR, $this->request->env('PATH'));
+
+ foreach ($paths as $path) {
+ foreach ($extensions as $extension) {
+ $file = "{$path}\\{$command}{$extension}";
+
+ if (is_file($file)) {
+ return $file;
+ }
+ }
+ }
+ }
}
?>
\ No newline at end of file
diff --git a/extensions/command/syntax/Phpca.php b/extensions/command/syntax/Phpca.php
index 9b97c01..d277fcf 100644
--- a/extensions/command/syntax/Phpca.php
+++ b/extensions/command/syntax/Phpca.php
@@ -21,7 +21,7 @@ class Phpca extends \app\extensions\command\syntax\Base {
$plugin = dirname(dirname(dirname(__DIR__)));
$command = '{:php} {:phpca} -p {:php} --standard {:standard} {:file}';
$replace = array(
- 'php' => trim(shell_exec('which php')),
+ 'php' => $this->_which('php'),
'phpca' => $plugin . '/libraries/phpca/src/phpca.php',
'standard' => $plugin . '/config/phpca_lithium_standard.ini',
'file' => $file