RedirectCreator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 9 1
1
<?php
2
3
namespace Wikibase\Api\Service;
4
5
use Mediawiki\DataModel\EditInfo;
6
use Wikibase\Api\WikibaseApi;
7
use Wikibase\DataModel\Entity\EntityId;
8
9
/**
10
 * @access private
11
 *
12
 * @author Addshore
13
 */
14
class RedirectCreator {
15
16
	/**
17
	 * @var WikibaseApi
18
	 */
19
	private $api;
20
21
	/**
22
	 * @param WikibaseApi $api
23
	 */
24
	public function __construct( WikibaseApi $api ) {
25
		$this->api = $api;
26
	}
27
28
	/**
29
	 * @param EntityId $from
30
	 * @param EntityId $to
31
	 * @param EditInfo|null $editInfo
32
	 *
33
	 * @return bool
34
	 */
35
	public function create( EntityId $from, EntityId $to, EditInfo $editInfo = null ) {
36
		$params = array(
37
			'from' => $from->__toString(),
38
			'to' => $to->__toString(),
39
		);
40
41
		$this->api->postRequest( 'wbcreateredirect', $params, $editInfo );
42
		return true;
43
	}
44
45
}