RedirectCreator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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 = [
37
			'from' => $from->__toString(),
38
			'to' => $to->__toString(),
39
		];
40
41
		$this->api->postRequest( 'wbcreateredirect', $params, $editInfo );
42
		return true;
43
	}
44
45
}
46