Example #1
0
 /**
  * Get file contents as stream
  *
  * Return the contents of the specified file as a PHP stream
  * 
  * @param pchRepository $repository 
  * @param string $file 
  * @return resource
  */
 protected function getFileContents(pchRepository $repository, $file)
 {
     $fileContents = $repository->buildSvnLookCommand('cat');
     $fileContents->argument($file);
     $fileContents->execute();
     if (!in_array('pchString', stream_get_wrappers())) {
         stream_wrapper_register('pchString', 'pchStringStream');
     }
     $stream = fopen('pchString://', 'w');
     fwrite($stream, $fileContents->stdoutOutput);
     fseek($stream, 0);
     return $stream;
 }
Example #2
0
 /**
  * Validate the current check
  *
  * Validate the check on the specified repository. Returns an array of 
  * found issues.
  * 
  * @param pchRepository $repository 
  * @return void
  */
 public function validate(pchRepository $repository)
 {
     $process = $repository->buildSvnLookCommand('changed');
     $process->execute();
     $files = preg_split('(\\r\\n|\\r|\\n)', trim($process->stdoutOutput));
     $issues = array();
     foreach ($files as $file) {
         if (!preg_match('(^[AM]\\s+(?P<filename>.*)$)', $file, $match)) {
             continue;
         }
         $issues = array_merge($issues, $this->checkKeywords($repository, $match['filename']));
     }
     return $issues;
 }
Example #3
0
 /**
  * Construct from repository path, and transaction
  * 
  * @param string $repository 
  * @param string $transaction 
  * @return void
  */
 public function __construct($repository, $transaction)
 {
     parent::__construct($repository);
     $this->transaction = (string) $transaction;
 }
Example #4
0
 /**
  * Validate the current check
  *
  * Validate the check on the specified repository. Returns an array of 
  * found issues.
  * 
  * @param pchRepository $repository 
  * @return void
  */
 public function validate(pchRepository $repository)
 {
     $process = $repository->buildSvnLookCommand('log');
     $process->execute();
     return $this->parse($process->stdoutOutput);
 }
Example #5
0
 /**
  * Construct from repository path, and version
  * 
  * @param string $repository 
  * @param string $version 
  * @return void
  */
 public function __construct($repository, $version)
 {
     parent::__construct($repository);
     $this->version = (string) $version;
 }