Created
December 20, 2014 17:59
-
-
Save Shaked/41c5c7145a9ad87b60a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Domain; | |
use Symfony\Component\Validator\Constraints\Null as Null; | |
class CodeSnifferShellCommand implements ShellCommand { | |
private $bin; | |
private $codePath; | |
private $handleStdOutCallback; | |
public function __construct($bin, $codePath, callable $handleStdOutCallback) { | |
$this->bin = $bin; | |
$this->codePath = $codePath; | |
$this->handleStdOutCallback = $handleStdOutCallback; | |
} | |
/** | |
* //TODO: use param instead of hardcoded json, requires a parser | |
* @return string | |
*/ | |
public function cmd() { | |
return sprintf( | |
"%s %s --report=%s", | |
$this->bin, | |
$this->codePath, | |
"json" | |
); | |
} | |
/** | |
* @return int|null | |
*/ | |
public function timeout() { | |
return null; | |
} | |
/** | |
* @param string $output | |
*/ | |
public function handleStdOut($output) { | |
$handleStdOutCallback = $this->handleStdOutCallback; | |
$handleStdOutCallback($output); | |
} | |
/** | |
* @param string $output | |
*/ | |
public function handleStdErr($output) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment