CodeReview::diff()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 1
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of Peachy MediaWiki Bot API
5
 *
6
 * Peachy is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
class CodeReview {
21
22
	private $wiki;
23
	private $repo;
24
25
	public function __construct(Wiki &$wikiClass, $repo)
26
	{
27
		$this->wiki = $wikiClass;
28
		$this->repo = $repo;
29
30
		if( !array_key_exists( 'CodeReview', $wikiClass->get_extensions() ) ) {
31
			throw new DependencyError( "CodeReview", "http://www.mediawiki.org/wiki/Extension:CodeReview" );
0 ignored issues
show
Documentation introduced by
'http://www.mediawiki.or...i/Extension:CodeReview' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
		}
33
	}
34
35
	public function update( $rev ) {
36
37
		Hooks::runHook( 'StartCodeReviewUpdate', array( &$rev ) );
38
39
		$apiRes = $this->wiki->apiQuery(
40
			array(
41
				'action' => 'codeupdate',
42
				'repo'   => $this->repo,
43
				'rev'    => $rev
44
			), true
45
		);
46
47
		print_r( $apiRes );
48
	}
49
50
	public function diff() { }
51
52
	public function testupload() { }
53
54
	public function comments() { }
55
56
}
57