Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
SubversionAdaptor
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
42
0.00% covered (danger)
0.00%
0 / 1
 newFromRepo
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
12
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 canConnect
n/a
0 / 0
n/a
0 / 0
0
 getFile
n/a
0 / 0
n/a
0 / 0
0
 getDiff
n/a
0 / 0
n/a
0 / 0
0
 getDirList
n/a
0 / 0
n/a
0 / 0
0
 getLog
n/a
0 / 0
n/a
0 / 0
0
 _rev
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Extension\CodeReview\Backend;
4
5abstract class SubversionAdaptor {
6    /**
7     * @var string
8     */
9    protected $mRepoPath;
10
11    /**
12     * @param string $repo
13     * @return SubversionAdaptor
14     */
15    public static function newFromRepo( $repo ) {
16        global $wgSubversionProxy, $wgSubversionProxyTimeout;
17        if ( $wgSubversionProxy ) {
18            return new SubversionProxy( $repo, $wgSubversionProxy, $wgSubversionProxyTimeout );
19        }
20
21        if ( function_exists( 'svn_log' ) ) {
22            return new SubversionPecl( $repo );
23        }
24
25        return new SubversionShell( $repo );
26    }
27
28    /**
29     * @param string $repoPath Path to SVN Repo
30     */
31    public function __construct( $repoPath ) {
32        $this->mRepoPath = $repoPath;
33    }
34
35    abstract public function canConnect();
36
37    /**
38     * @param string $path
39     * @param int|null $rev
40     */
41    abstract public function getFile( $path, $rev = null );
42
43    /**
44     * @param string $path
45     * @param int|null $rev1
46     * @param int|null $rev2
47     */
48    abstract public function getDiff( $path, $rev1, $rev2 );
49
50    /**
51     * @param string $path
52     * @param int|null $rev
53     */
54    abstract public function getDirList( $path, $rev = null );
55
56    /**
57     * @param string $path
58     * @param int|null $startRev
59     * @param int|null $endRev
60     */
61    abstract public function getLog( $path, $startRev = null, $endRev = null );
62
63    /**
64     * @param int|string $rev
65     * @param int $default
66     * @return int
67     */
68    protected function _rev( $rev, $default ) {
69        if ( $rev === null ) {
70            return $default;
71        }
72
73        return intval( $rev );
74    }
75}