@@ -10,7 +10,13 @@ class PHPCS_Diff_SVN {
1010 public $ repo ; // repository's slug.
1111 public $ repo_url ; // SVN repository URL.
1212
13- function __construct ( $ repo ) {
13+ function __construct ( $ repo , $ options = array () ) {
14+
15+ if ( true === is_array ( $ options ) && false === empty ( $ options ) ) {
16+ foreach ( $ options as $ option => $ value ) {
17+ $ this ->$ option = $ value ;
18+ }
19+ }
1420
1521 $ repo = sanitize_title ( $ repo );
1622
@@ -158,8 +164,8 @@ public static function parse_diff_for_info( $diff_file ){
158164 }
159165
160166 public function run_phpcs_for_file_at_revision ( $ filename , $ revision , $ phpcs_command , $ standards_location , $ phpcs_standard ) {
161- $ command_string = sprintf ( 'svn cat %s --non-interactive --no-auth-cache --username %s --password %s -r %d | %s --runtime-set installed_paths %s --standard=%s --stdin-path=%s ' ,
162- escapeshellarg ( esc_url_raw ( trailingslashit ( $ this ->repo_url ) . $ filename ) ),
167+ $ command_string = sprintf ( 'svn cat %s --non-interactive --no-auth-cache --username %s --password %s -r %d | %s --runtime-set installed_paths %s --standard=%s --stdin-path=%s ' ,
168+ escapeshellarg ( esc_url_raw ( trailingslashit ( $ this ->repo_url ) . ltrim ( $ filename, ' / ' ) ) ),
163169 escapeshellarg ( $ this ->svn_username ),
164170 escapeshellarg ( $ this ->svn_password ),
165171 absint ( $ revision ),
@@ -172,4 +178,4 @@ public function run_phpcs_for_file_at_revision( $filename, $revision, $phpcs_com
172178 return shell_exec ( $ command_string );
173179 }
174180
175- }
181+ }
0 commit comments